ios - 遇到应用程序传输安全问题

标签 ios plist 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.

当尝试从网络上获取图像时,我知道这必须与 iOS9 应用程序传输安全性有关,但问题是在我的 plist 中,我将“允许任意加载”设置为 true。

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

有人有什么想法吗?

enter image description here

最佳答案

异常(exception)域中,您可以为特定域定义安全性。在此字典中,您可以覆盖使用 NSAllowArbitoryLoads 定义的内容,例如:

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

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

有关更多信息,请参阅 NSAppTransportSecurity in Apple docs

关于ios - 遇到应用程序传输安全问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34950050/

相关文章:

ios - StartInterval 键如何影响启动的守护进程

iphone - writeToFile 未将新条目保存到 plist 中

ios - 是否可以根据 map View 的中心抓取城市等信息

ios - 如何在 UICollectionViewCell 中使用详细信息披露按钮?

iphone - 如何在设备重启时在后台运行 ios 应用程序?

python - 在 python 中编辑 plist

ios - TIC TCP 连接失败 1 :54 Err(54)

iOS 9 Facebook 登录模拟器-canOpenURL : failed for URL: "fbauth2:///" - error: "(null)"

ios - 为什么无法访问?

ios - 文件名参数带有通配符的 PathForResource