自己証明書だと、通信に失敗するでの軒並みOKにするには下のコードで行ける!!
おすすめはしない!!
※ コマンドラインでしか試してません ※
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
return YES;
}
- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection {
return YES;
}
- (void) connection:(NSURLConnection *)conn didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
NSURLProtectionSpace * protectionSpace = [challenge protectionSpace];
NSURLCredential* credentail = [NSURLCredential credentialForTrust:[protectionSpace serverTrust]];
[[challenge sender] useCredential:credentail forAuthenticationChallenge:challenge];
}
0 件のコメント:
コメントを投稿