[英]Can't access any web service in ios from app store
I used NSURLConnect in my app to start web service connection. 我在应用程序中使用NSURLConnect来启动Web服务连接。 I knew that apple deprecated this interface since ios 9.0 for more safty, while it also said a way to support http(add some para in xcode config to forbid ATS). 我知道苹果从ios 9.0起就不再使用此接口了,以便更安全,同时它还说了一种支持http(在xcode配置中添加一些段以禁止ATS)的方法。 I exactly did as it said, and it run well when I developed(use usb connect to ipad which run in ios 9). 我完全按照它说的做,并且在我开发时运行良好(使用usb连接到在ios 9中运行的ipad)。
My app was designed for inner net envirenment. 我的应用程序是为内部网络环境设计的。 I uploaded a vedio for detail introduce when I submit it to apple, because they certainly could not connect to my server. 我上传了一个视频,以便在提交给Apple时进行详细介绍,因为它们肯定无法连接到我的服务器。 Nicely they approved my app. 很好,他们批准了我的应用。
Now I'm very glad to say my app is ready for sale. 现在,我很高兴地说我的应用已准备好出售。 But when I setup it from app store and run, strange thing happens, it can not connect to the server! 但是,当我从应用程序商店安装并运行它时,发生了奇怪的事情,它无法连接到服务器! Through log I see the reason is no byte send succeefully by NSURLConnect sendSynchronousRequest. 通过日志,我看到原因是没有字节被NSURLConnect sendSynchronousRequest成功发送。 Why it runs well by devoloping, I am sure the code I submit is the same, and the ipad is run as ios 9. 为什么通过开发可以正常运行,我确定提交的代码是相同的,并且ipad作为ios 9运行。
I guess maybe I do something wrong during uploading. 我想也许我在上传过程中做错了。 There is some info of my develop envirenment: 有关我的开发环境的一些信息:
Build Active Architecture Only Debug Yes Release No 仅构建活动体系结构调试是发行版否
I use xcode Archive to upload. 我使用xcode存档上传。 BTW, I have tested in ipad runs in ios 8.2 it was also not right. 顺便说一句,我已经在ios 8.2中的ipad中测试了它也不合适。
As of 9.0 Apple made ssl a requirement but in the meantime provided a workaround. 从9.0开始,Apple要求ssl,但与此同时提供了一种解决方法。
Make sure your Info.plist
file has NSAppTransportSecurity added to it. 确保您的Info.plist
文件已添加NSAppTransportSecurity。 This example will allow you to make any connection. 此示例将允许您进行任何连接。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.