Webサービスにアクセスしていて、接続しようとするとこのエラーが発生します(WebサービスはXMLRPCであり、リクエストと応答の処理にwordpress xmlrpcソースコードを使用しています):
エラードメイン=NSURLErrorDomainコード=-1202「このサーバーの証明書が無効です。機密情報を危険にさらす可能性のある「<strong>**。org」のふりをしているサーバーに接続している可能性があります。」
WebServiceの人々は、証明書の検証部分を無視すると言っているので、誰かがそれを行う方法を知っているなら、それは私にとって大きな助けになるでしょう。
いくつかの提案の後、私は以下のNSURLConnectionデリゲートを使用しましたが、同じエラーが発生します
-(BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
if ([trustedHosts containsObject:challenge.protectionSpace.host])
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}