自己署名 SSL 証明書を使用し、Web サービスを実行している tomcat サーバーがあります。Restkit を使用して Web サービスに接続しようとしています。ただし、証明書の有効性に関連するエラーが発生します。これが私のコードです:
NSURL *url=[NSURL URLWithString:baseURL];
RKClient *client = [RKClient clientWithBaseURL:url];
client.disableCertificateValidation=YES;
RKRequest *request = [client requestWithResourcePath:[NSString stringWithFormat:@"/addEvent?deviceID=%@&eventID=%@",deviceID,eventID]];
request.disableCertificateValidation=YES;
request.delegate=self;
RKResponse *response = [request sendSynchronously];
このリクエストは次のエラーで失敗します:
2013-01-09 15:11:53.931 Mobile_ACPL[5761:907] The certificate for this server is invalid. You might be connecting to a server that is pretending to be “notify.acpl.lib.in.us” which could put your confidential information at risk.
disableCertificateValidation を YES に設定しても、このエラーが発生します。どうすればこれを機能させることができますか?
編集:ここに示すように証明書を追加しようとしました: https://github.com/RestKit/RestKit/pull/131
それでも同じ結果が得られます。
編集 2: RKRequest.m のこの行にエラー メッセージが設定されているようです。
payload = [NSURLConnection sendSynchronousRequest:_URLRequest returningResponse:&URLResponse error:&error];