【发布时间】:2020-08-26 12:31:52
【问题描述】:
我无法在 swift 5、XCode 版本 11.6 (11E708) 和 iOS 13.6 中发布到服务器。我收到此错误:
2020-08-26 08:20:55.252545-0400 iris[1642:721953] Task <BBB3809B-7BEF-4F60-9685-774027ADA7E6>.<1> finished with error [-1022] 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=0x2810ad710 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://localhost:8000/searchImage/, NSErrorFailingURLKey=http://localhost:8000/searchImage/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
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=0x2810ad710 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://localhost:8000/searchImage/, NSErrorFailingURLKey=http://localhost:8000/searchImage/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
我已经关注了这个问题How can I delete derived data in Xcode 8? 并更新了我的 info.plist
<key> App Transport Security Settings </key>
<dict>
<key> Allow Arbitrary Loads </key>
<true />
请注意,此时我并不关心安全性。此外,我尝试了一个干净的构建,然后删除了我的派生数据文件夹,但我仍然无法发布到服务器。在另一个项目中,我在 Info.plist 中设置了这个键,一切都很好。有什么建议吗?
【问题讨论】: