2016-09-23 39 views
1

相同的网址在低于iOS10(例如iOS8,iOS9)的情况下运行正常。WebView Url在iOS10中没有满载?

-(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]; 
} 

回答

0

我想你的代码,并在IOS 10工作正常,Xcode中8

我用这个,

-(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]; 
} 

而且调用这个方法您想使用

在您的plist文件中为您的网址添加URLSchemes。

我越来越喜欢的WebView,

ios 10 WebView

您的代码是没有错的。

希望这会帮助你。

+0

的WebView链接在iOS10没有完全加载它只是部分负荷应用。为问问题我使用了虚拟url。 – Nikunj

+0

你可以发布你所得到的图片吗? @Nikunj – KAR

0

在在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]; 
+0

同样的问题,不工作.. – Nikunj

+0

这个苹果网址也没有正确加载。 –