ATS App Transport Security: HTTP url inside Webview

天大地大妈咪最大 提交于 2019-12-04 17:58:54

I did a quick test and it appears that any referenced resources that are needed to be loaded by the UIWebView to properly display the page must abide by the ATS rules, but also follow any exceptions you have specified in the Info.plist for your project. If the I tried to follow a link to a non-https site in the UIWebView, it gave me errors as well.

I think your best bet would be to use the SFSafariViewController conditionally for iOS 9 users. You can continue to use the UIWebView for the iOS 7 and iOS 8 devices, which do not strictly enforce ATS. This imposes fome extra code, but it should be minimal.

Also, just a clarification on Apple's changes around enforcement of App Transport Security. They announced that App Transport Security would be required for apps submitted after December 31, 2016. This means the impact is not so much based on the user's device OS, but rather the developers who are submitting. Also, Apple is still allowing exceptions to be added, as long as you have a justification. We do not yet know what types of justifications Apple will allow. Finally, Apple stated in their WWDC session that apps could still include an exception to the forward secrecy part of the ATS requirements without a separate justification. Until we get to 1/1/2017, though, we will not know for sure how this will work.

Edit: It appears Apple has added a new exception you can use to allow non-ATS connections in UIWebview and WKWebview instances. It is NSAllowsArbitraryLoadsInWebContent. This should do exactly what you are looking for. Here is a great summary of the latest with ATS: preparing for ATS in 2017.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!