ios - 如何让 Charles 在 SSL 连接上使用 Xcode 7?

标签 ios ssl xcode7 charles-proxy

我在使用新安装的 Xcode 7 时遇到问题,即使通过 Charles 在 iOS 模拟器上安装了 SSL 证书(帮助 > SSL 代理 > 在 iOS 模拟器中安装 Charles 根证书),并明确允许域我在 Charles 中查询的服务器,任何监听 SSL 流量的尝试都会导致连接失败。

Charles 报告以下错误:

SSLHandshake: Remote host closed connection during handshake You may need to configure your browser or application to trust the Charles Root Certificate. See SSL Proxying in the Help menu.

Xcode 控制台报告:

2015-09-23 11:29:44.173 Citifyd[8352:449043] Error in registration. Error: Error Domain=NSCocoaErrorDomain Code=3010 "REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION" UserInfo={NSLocalizedDescription=REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION} 2015-09-23 11:29:44.483 Citifyd[8352:449381] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) 2015-09-23 11:29:44.509 Citifyd[8352:449043] API ERRROR Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made."

在相同的设置下,Xcode 6 一切正常 - 有人有任何想法吗?

最佳答案

我根据这个线程解决了这个问题: https://forums.developer.apple.com/thread/4988

iOS 9(Xcode 7 模拟器运行)对 SSL 传输有更严格的要求 - 来自上述线程中的用户“Poets”:

iOS 9 forces connections that are using HTTPS to be TLS 1.2 to avoid recent vulnerabilities. In iOS 8 even unencrypted HTTP connections were supported, so that older versions of TLS didn't make any problems either. As a workaround, you can add this code snippet to your Info.plist:

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

这使 Charles 能够在使用 iOS 9 模拟器时向您显示未加密的流量。分发应用后,您可能希望禁用此功能。

关于ios - 如何让 Charles 在 SSL 连接上使用 Xcode 7?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32746968/

相关文章:

ios - "Allocation Type"菜单在 Instruments 中被禁用

c++ - C++ 电子邮件客户端中的 OpenSSL - 服务器关闭与 TLSv1 警报消息的连接

python - discord.py `SSL certificate verify failed` 错误

email - Mandrill - 入站电子邮件处理路由不适用于 SSL

ios - 如何在 xcode 7 中通过代码调用不同的 View

Xcode 没有设备注册错误

ios - 将字符串数组附加到 Swift 中的字符串

ios - 为什么纬度和经度在 ios 9 中显示为零?

ios - 从 Firebase 存储检索图像时出现错误 nil

swift2 - 为什么我没有得到这个 Metal 内核的结果