[英]WebView Url not full load in iOS10?
Same url in run in lower then iOS10 (ex. iOS8,iOS9) work properly. 低于iOS10(例如iOS8,iOS9)中运行的相同网址正常运行。
-(void) loadUrl
{
NSString *urlAddress = @"http://myurl.com";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[detailWebView loadRequest:requestObj];
}
I tried your code and it works fine in ios 10 and xCode 8. 我尝试了你的代码,它在ios 10和xCode 8中运行良好。
I used this, 我用过这个,
-(void) loadUrl
{
NSString *urlAddress = @"http://google.com";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[self.webView loadRequest:requestObj];
}
And call this method where you want using [self loadUrl];
并使用
[self loadUrl];
调用此方法[self loadUrl];
Add URLSchemes in your plist file for your url. 在您的plist文件中为您的网址添加URLSchemes。
I am getting webview like, 我正在获取webview,
Your code is not wrong. 你的代码没错。
Hope this will help you. 希望这会帮助你。
In apps that run in iOS 8 and later, use the WKWebView class instead of using UIWebView.import webkit.h and use this code 在iOS 8及更高版本中运行的应用程序中,使用WKWebView类而不是使用UIWebView.import webkit.h并使用此代码
#import <WebKit/WebKit.h>
WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
WKWebView *webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:theConfiguration];
NSURL *nsurl=[NSURL URLWithString:@"http://www.apple.com"];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webView loadRequest:nsrequest];
[self.view addSubview:webView];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.