我正在使用 ASIHTTPRequest v1.8.1 发出 HTTPS 请求。问题是它在 iOS 5.0 和 5.0.1 上不起作用,而在 5.1 和 5.1.1 上却可以正常工作。代码很简单:
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:RemoteNotiURL]];
[request setPostValue:@"i" forKey:@"plat"];
[request setPostValue:token forKey:@"token"];
[request setValidatesSecureCertificate:NO];
[request setCompletionBlock:^{
NSLog(@"done");
}];
[request setFailedBlock:^{
NSLog(@"error = %@", [request error]);
}];
[request startAsynchronous];
RemoteNotiURL
是一个类似https://xxx.example.com的 URL
错误是:
error = Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred: SSL problem (Possible causes may include a bad/expired/self-signed certificate, clock set to wrong date)" UserInfo=0x18460b0 {NSUnderlyingError=0x1853ab0 "The operation couldn’t be completed. (OSStatus error -9800.)", NSLocalizedDescription=A connection failure occurred: SSL problem (Possible causes may include a bad/expired/self-signed certificate, clock set to wrong date)}
我能做些什么呢?