Fixes ITMS-90809 about UIWebView deprecation (#390)

This commit is contained in:
Mathieu Virbel 2019-09-22 19:52:42 +02:00 committed by GitHub
parent 2ec7cb5ce0
commit 5a175f44a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -45,7 +45,7 @@ def open_url_wbv(url, width, height):
`width`: int `width`: int
Width of the window Width of the window
Example for opening up a web page in UIWebview:: Example for opening up a web page in WKWebview::
import ios import ios
url = "http://www.google.com" url = "http://www.google.com"

View file

@ -4,6 +4,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include <WebKit/WebKit.h>
#include "ios_wrapper.h" #include "ios_wrapper.h"
void ios_open_url(char *url) void ios_open_url(char *url)
@ -18,7 +19,7 @@ void ios_open_url(char *url)
void load_url_webview(char *url, int width, int height) void load_url_webview(char *url, int width, int height)
{ {
NSString *nsurl = [NSString stringWithCString:(char *)url encoding:NSUTF8StringEncoding]; NSString *nsurl = [NSString stringWithCString:(char *)url encoding:NSUTF8StringEncoding];
UIWebView *webView = [[UIWebView alloc] initWithFrame: CGRectMake(0, 0, width, height)]; WKWebView *webView = [[WKWebView alloc] initWithFrame: CGRectMake(0, 0, width, height)];
UIWindow *window = [[UIApplication sharedApplication] keyWindow]; UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIView *view = [window.rootViewController view]; UIView *view = [window.rootViewController view];
[view addSubview:webView]; [view addSubview:webView];