objective-c – iOS 5:https(ASIHTTPRequest)停止工作

我有一个使用ASIHTTPRequest的应用程序.

我用iOS 5(sdk:5.0 / xcode:4.2 Build 4D199)重新编译我的应用程序,https连接失败并显示错误消息(与禁用https相同的调用正常):

Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0xa8e66e0 {NSUnderlyingError=0xa8ac6c0 "The operation Couldn’t be completed. (Osstatus error -9844.)",NSLocalizedDescription=A connection failure occurred}

启用调试日志:

[STATUS] Starting asynchronous request <ASIFormDataRequest: 0xd96fc00>

[CONNECTION] Request <ASIFormDataRequest: 0xd96fc00> will not use a persistent connection

[STATUS] Request <ASIFormDataRequest: 0xd96fc00>: Failed

[CONNECTION] Request #(null) Failed and will invalidate connection #(null)

我发现这个相关帖子:
https://devforums.apple.com/message/537440#537440
这可以解释我的问题.

基于iOS 5喜欢TLS 1.2的想法,我尝试在AIHTTPRequest.m中更改设置kcfStreamSocketSecurityLevelTLSv1

NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
                                     [NSNumber numberWithBool:YES],kcfStreamSSLAllowsExpiredCertificates,[NSNumber numberWithBool:YES],kcfStreamSSLAllowsAnyRoot,[NSNumber numberWithBool:NO],kcfStreamSSLValidatesCertificateChain,kcfNull,kcfStreamSSLPeerName,kcfStreamSocketSecurityLevelTLSv1,kcfStreamSsllevel,// my modif
                                     nil];

没有成功.也许我的修改是不正确的?

细节:

>我的ARC被禁用了
>我使用libz.1.2.5.dylib
>一周前我更新了ASIHTTPRequest.

我不知道问题是证书故事(如TLS版本)还是其他内容.

任何帮助/想法是欢迎!

解决方法

这是最终的解决方案:

https://developer.apple.com/library/ios/#technotes/tn2287/_index.html#//apple_ref/doc/uid/DTS40011309

NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
                                       [NSNumber numberWithBool:YES],@"kcfStreamSocketSecurityLevelTLSv1_0SSLv3",nil];

添加此参数:

@"kcfStreamSocketSecurityLevelTLSv1_0SSLv3",

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...