我有一个被不同公司使用的应用程序。用户首先需要使用始终相同的base-url登录整个webservice。当他成功登录时,我从webservice得到一个base url(带有htttps)。但是每个公司的基本网址是不同的。
现在,当我在IOS9中启动我的应用程序并登录并尝试用不同的基url调用webservices时,我会得到以下错误:
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9847, NSErrorFailingURLStringKey=https://81.82.219.213:8080/TechAppService/TechAppService.svc//authuser?login=***&password=***我知道我需要在NSAppTransportSecurity中设置info.plist字典。现在的问题是,我不知道如何在代码中设置它。
发布于 2015-10-14 08:17:18
Step-1
选择info.plist并单击右键->转到Source Code

Step-2
以Key格式打开的源代码,在该键上最后添加以下键
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>您可以看到类似于示例输出。

Step - 3
它自动添加到您的plist中,如下所示

发布于 2015-10-14 08:16:09
这是因为iOS 9 SDK在应用程序中使用网络的变化很少。您需要在info.plist文件中添加以下键。
Step 1:在您的项目中打开info.plist文件。
Step 2:添加App Transport Security Settings键。
Stpe 3:添加子键Allow Arbitrary Loads并将值设置为YES。
以上就是更多的细节,阅读苹果文档。

发布于 2015-10-14 08:16:21
请在Info.plist中设置它。有关更多信息,请参见给定图像中的

https://stackoverflow.com/questions/33120001
复制相似问题