11/04/2015

Apple在iOS 9強化安全的ATS措施 (App Transport Security)

升級之後可能發生的錯誤現象:

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.

解決辦法有很多種:
若你的App會從很多來源下載HTTP頁面, 直接Allow Arbitrary Loads

如果你的App只會從你的服務網域下載資料, 請使用Exception Domains
以個別的方式加入例外, 記得your.domain是一個Dictionary, NSTemporaryExceptionAllowsInsecureHTTPLoads (NSExceptionAllowsInsecureHTTPLoads是錯誤的)和
NSIncludeSubDomains是Boolean如下圖:

我是使用Xcode 7.1
請留意一下, Exception Domains是可以在Xcode內下拉選擇,
但是IncludesSubdomains前面要有NS開頭, 不信的話用其他編輯器打開Info.plist.

參考資料:
http://www.neglectedpotential.com/2015/06/working-with-apples-application-transport-security/
http://googleadsdeveloper.blogspot.tw/2015/08/handling-app-transport-security-in-ios-9.html

沒有留言: