卧倒,发现UIWebView改WKWebView解题思路

1.首先在XCode里搜索UIWebView关键字。一堆堆的。一步步改吧。

引入#import 

替换UIWebView声明

@property (nonatomic, strong) WKWebView *webView;

然后替换delegate

self.webView.navigationDelegate = self;

再然后替换协议方法

 -- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {

替: (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error

+{

    [self hideHud];

    [self showHint:@"加载失败"];

}

-- (void)webViewDidStartLoad:(UIWebView *)webView {

替:- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation

+{

+   

}

-

-- (void)webViewDidFinishLoad:(UIWebView *)webView{

-    [self hideHud];

替: - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation

+{

+    [self hideHud];

}


2.替完所有文件后,发现上传还不让你过,啥办?

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).


进入工程目录:输入此命令

grep -r UIWebView .


找到又是一堆相关的第三方包,.a包。好吧一个一个更新成最新的吧。


再次上传,完美成功。

你可能感兴趣的:(卧倒,发现UIWebView改WKWebView解题思路)