ios13苹果对UIWebView不再支持;请采用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>
并且提交苹果商店的时候,App Store Connect 也发来邮件警告
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的相关内容,比如WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m,查看源码发现这个两个类是独立存在的,所以直接删除这两个类就能解决问题;
解决方法一:
把WebViewJavascriptBridge下载到项目中直接删除WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件。
解决方法二:
我们的项目中使用了别的项目组的私有库,而私有库中也使用了WebViewJavascriptBridge所以下载到本地的方法行不通了,所以想到了在项目中的所有SDK下载完成后去除“过期的”文件,具体实现如下:
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