【发布时间】:2014-01-09 12:45:40
【问题描述】:
谁能帮助我了解如何使用 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];
}
当我实现上述委托时,我成功地得到了服务器的响应。谁能帮我知道这是如何工作的。委托中的每个参数是什么以及它在做什么?
提前致谢。
【问题讨论】:
标签: ios objective-c https nsurlconnectiondelegate