获取应用程序传输安全问题

Getting App Transport Security problems

嘿,我收到了这个错误:

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.

当试图从网络上获取图像时,我知道这必须与 iOS9 App Transport Security 有关,但问题是在我的 plist 中我将 Allow Arbitrary Loads 设置为 true .

除此之外,我真的找不到解决这个问题的更多方法了。

有没有人有什么想法?

Exception Domains 中,您为特定域定义了安全性。在此词典中,您可以覆盖用 NSAllowArbitoryLoads 定义的内容,例如:

NSAppTransportSecurity
    NSAllowsArbitraryLoads = YES  
    NSExceptionDomains
        "unsecure-server-i-control.example.com"
        NSExceptionAllowsInsecureHTTPLoads = NO

一般情况下允许任意加载,但特别是 unsecure-server-i-control.example.com 不允许。

有关详细信息,请参阅 NSAppTransportSecurity in Apple docs