我有一个由不同公司使用的应用程序。用户首先需要始终使用相同的base-url登录整个web服务。当他成功登录时,我从webservice获得一个base-url(带有htttps)。但是这个base-url对于每个公司都不相同。在代码中配置NSAppTransportSecurity
现在,当我开始我的IOS9应用程序,我登录并尝试调用Web服务具有不同的基URL,我得到这个错误:
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=***
我知道,我需要建立info.plist中的NSAppTransportSecurity字典。现在的问题是,我不知道如何在代码中设置它。
你的问题不是,如何使用info.plist启用所有任意加载,但是如何在运行时配置特定于域的异常,是否正确? –