【发布时间】:2016-02-15 22:20:15
【问题描述】:
我阅读了很多关于它的问题,但我仍然有问题。
当我使用 localhost 并从我的模拟器中纠正 NSAppTransportSecurity optinos 时,一切都是正确的。
现在我正在我的 iphone 上进行调试。 iphone和mac都连接到同一个网络。
我检查了我的mac的IP地址
我将它添加到 NSAppTransportSecurity,如下所示:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>10.250.x.x</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
我仍然收到错误:
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.
error = Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x7f904d300170 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://10.250.x.x:8080/IVRServer/api/registration/register, NSErrorFailingURLKey=http://10.250.x.x:8080/IVRServer/api/registration/register, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
我应该在我的 plist 中添加任何其他内容吗?
请不要认为这个问题是重复的,因为我已经在我的 plist 中使用了正确的设置,并且它工作正常,但是当我将服务器更改为不是 localhost 时它不起作用
我错过了什么?
【问题讨论】:
标签: ios objective-c iphone swift macos