ios13蘋果對(duì)UIWebView不再支持;請(qǐng)采用WKWebView
UIKIT_EXTERN API_DEPRECATED("No longer supported; please adopt WKWebView.", ios(2.0, 12.0)) API_UNAVAILABLE(tvos, macos) @interface UIWebView : UIView <NSCoding, UIScrollViewDelegate>
并且提交蘋果商店的時(shí)候噪矛,App Store Connect 也發(fā)來郵件警告
Dear Developer,
We identified one or more issues with a recent delivery for your app, "XXXX" 1.0.0. (1.0.0). Your delivery was successful, but you may wish to correct the following issues in your next delivery:
ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs . See https://developer.apple.com/documentation/uikit/uiwebview for more information.
After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to App Store Connect.
Best regards,
The App Store Team
但是有些第三方SDK還沒有去除UIWebView的相關(guān)內(nèi)容,比如WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m继蜡,查看源碼發(fā)現(xiàn)這個(gè)兩個(gè)類是獨(dú)立存在的,所以直接刪除這兩個(gè)類就能解決問題;
解決方法一:
把WebViewJavascriptBridge下載到項(xiàng)目中直接刪除WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件夹攒。
解決方法二:
我們的項(xiàng)目中使用了別的項(xiàng)目組的私有庫,而私有庫中也使用了WebViewJavascriptBridge所以下載到本地的方法行不通了胁塞,所以想到了在項(xiàng)目中的所有SDK下載完成后去除“過期的”文件,具體實(shí)現(xiàn)如下:
platform :ios, '9.0'
project 'TestDemo.xcworkspace'
target 'TestDemo' do
pod 'WebViewJavascriptBridge', '~> 6.0.3'
#刪除WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件
pre_install do |installer|
dir_web = File.join(installer.sandbox.pod_dir('WebViewJavascriptBridge'), 'WebViewJavascriptBridge')
Dir.foreach(dir_web) {|x|
real_path = File.join(dir_web, x)
if (!File.directory?(real_path) && File.exists?(real_path))
if(x == 'WebViewJavascriptBridge.h' || x == 'WebViewJavascriptBridge.m')
File.delete(real_path)
end
end
}
end
end