OGeek|极客世界-中国程序员成长平台

标题: ios - 遇到应用程序传输安全问题 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 18:20
标题: ios - 遇到应用程序传输安全问题

嘿,我收到了这个错误:

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.

当尝试从 Web 获取图像时,我知道这必须与 iOS9 应用程序传输安全性有关,但问题是在我的 plist 中,我将 Allow Arbitrary Loads 设置为 true。

然后我真的找不到更多解决这个问题的方法了。

有人有什么想法吗?

enter image description here



Best Answer-推荐答案


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

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






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4