【问题标题】:Why am I ALWAYS getting SSL error when contacting Parse.com?为什么我在联系 Parse.com 时总是收到 SSL 错误?
【发布时间】:2015-08-07 18:48:02
【问题描述】:

环境: Xcode 7.0/斯威夫特 2.0。

我可以通过 Xcode 6.4/Swift 1.2 连接解析;但在切换到 Xcode 7.0/Swift 2.0 后,我收到了以下运行时连接错误:

发生 SSL 错误,无法与服务器建立安全连接。 (代码:100,版本:1.7.5)

[错误]:网络连接失败。睡觉后尝试5 9.864530 秒。 NSURLSession/NSURLConnection HTTP 加载失败 (kCFStreamErrorDomainSSL, -9802)

我读到这可能是由于 iOS 9 的security setup
设置 .plist 值“NSAppTransportSecurity”以关闭此安全检查并没有改变任何东西。

此问题出现在仿真或设备中;每次。

如何像往常一样访问 parse.com?

【问题讨论】:

  • 我遇到了这个问题,当您说您添加了 NSAppTransportSecurity 时,您是否将其添加为 NSApp... 作为字典并在 NSAllowsArbitraryLoads 中添加?在此处查看代码 NSAppTransportSecurityNSAllowsArbitraryLoads
  • 我已经上传了一份关于安全性的 plist 的快照。这并没有改变结果。

标签: parse-platform swift2


【解决方案1】:

我去Apple's Security Doc site 发现我没有正确设置我的plist。以下作品:这允许我在 iOS9 中访问解析:

【讨论】:

    【解决方案2】:

    你只需要在你的代码中添加这个:

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

    【讨论】:

      猜你喜欢
      • 2014-01-10
      • 2018-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-07
      • 1970-01-01
      相关资源
      最近更新 更多