iOS10 的App Transport Security

在项目中遇到的问题:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

很明显是ATS阻止了http的请求,但是明明在plist中已经添加了'Allow Arbitrary Loads = YES'了,按道理应该是禁用了苹果的ATS机制了,但是却没有用??

各种折腾,最后终于找到问题了,iOS 10新添加的特性造成的影响'NSAllowsArbitraryLoadsInWebContent'这个属性和'NSAllowsArbitraryLoads'共存的时候,默认'NSAllowsArbitraryLoads'会被忽略掉,不管'NSAllowsArbitraryLoadsInWebContent'是YES还是NO,只要存在就行了。但是在iOS9上面就不会了,因为这个属性iOS10才有,在iOS9系统上压根不起作用

具体可以参考文章
http://blog.csdn.net/u012947646/article/details/51915985

iOS10 的App Transport Security_第1张图片
Snip20170724_2.png

苹果官方文档关于info.plist:https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html

你可能感兴趣的:(iOS10 的App Transport Security)