繁体   English   中英

iOS10中的WebView Url没有满载?

[英]WebView Url not full load in iOS10?

低于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];
 }

我尝试了你的代码,它在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];
}

并使用[self loadUrl];调用此方法[self loadUrl];

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

我正在获取webview,

ios 10 WebView

你的代码没错。

希望这会帮助你。

在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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM