iOS 9本机应用程序无法通过https连接到mobilefirst服务器

时间:2015-11-18 17:08:53

标签: xcode swift ibm-mobilefirst

我已按照以下指南开发了XCode 7和MobileFirst 7.0中的原生iOS MobileFirst应用程序:https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/hello-world/configuring-a-native-ios-with-the-mfp-sdk/

该应用程序是在swift中开发的。

我已经通过修改info.plist配置在iOS 9中配置了App Transport Security Exceptions:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key><true/>
</dict>

通过https连接时,此修复程序消除了我在日志中遇到的SSL错误。但是,之后,我在通过https:

连接时在XCode中收到此错误
2015-11-18 17:41:07.914 AdapterBasedAuthSwift[56303:764042] Failed connecting to MobileFirst Server. Response: The operation couldn’t be completed. (NSURLErrorDomain error -1012.)

随着http工作正常。

我正在使用生产服务器进行测试,而不是工作室。

1 个答案:

答案 0 :(得分:2)

在开发期间,最简单的方法是在info.plist中禁用ATS:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key><true/>
</dict>