【发布时间】:2016-03-19 20:05:04
【问题描述】:
我正在尝试向我的个人网站发出 alamofire GET 请求,但我还没有 ssl。我尝试将以下代码行添加到 info.plist 并且仍然没有运气:
1) 完全禁用它
<key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
2) 允许我的个人网址
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
但我不断收到同样的错误...
2016-03-19 13:02:07.770 appName[51705:9917289] 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.
[Request]: <NSMutableURLRequest: 0x7fcc92032140> { URL: http://www.myurl.com/sup?geoSearchWord=test }
[Response]: nil
[Data]: 0 bytes
[Result]: FAILURE: Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."
【问题讨论】: