任何人都可以帮助我了解如何使用 NSRULConnection 处理 https 请求吗?我已经阅读了很多教程和 Apple 文档。但我无法理解它是如何工作的。我已经实现了以下代表来处理 https 请求。
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
}
当我实现上述委托时,我成功地得到了服务器的响应。谁能帮我知道这是如何工作的。委托中的每个参数是什么以及它在做什么?
提前致谢。