loadHTMLString 警告 "Null passed to a callee that requires a non-null argument" IOS9 Obj-C

loadHTMLString warn "Null passed to a callee that requires a non-null argument" IOS9 Obj-C

我刚刚安装了 xcode 7 和 ios 9.1,我在网络视图上收到了这个警告:

Null passed to a callee that requires a non-null argument

这是触发错误的代码:

-(void)viewWillDisappear:(BOOL)animated
{
    if(exitView)
        [ytView.webView loadHTMLString:nil baseURL:nil];
}

这样当用户返回时,webView(播放YT视频)停止了,之前它工作正常,为什么现在给出这个警告? 我该如何解决?

我不确定,但从警告消息中可以清楚地看出,现在您不能将 nil 值发送到此方法。为什么不直接删除 UIWebView 或在 viewWillDisappear 中将 UIWebView 设置为 nil。

[ytView.webView loadHTMLString:"" baseURL: [NSURL URLWithString:@"http://"] ];

取自 http://iaintheindie.com/2015/08/16/updating-apps-for-ios-9/

问候

更改 CDVInAppBrowser.m 行中的 return 类型..

732    [self.webView loadHTMLString:@"" baseURL:nil];
1002  (UIInterfaceOrientationMask)supportedInterfaceOrientations