【发布时间】:2013-03-13 17:15:25
【问题描述】:
我使用[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)]从web服务拉取数据,但是web服务器有自发证书,导致出现这个错误:
错误显示使用:
NSAlert *a = [NSAlert alertWithError:error];
[a runModal];
有没有办法忽略这个错误并继续?
【问题讨论】:
-
我认为这个问题之前已经被问过,并且已经找到并重新命名了之前的问题。希望它能解决您的问题。
-
你说得对,这是一个骗子(虽然我没有得到那个答案,因为我搜索了
sendAsynchronousRequest,所以这个问题专门针对那个方法)。 -
“使用 NSURLConnection 忽略 SSL 证书错误” - 最好解决问题而不是忽略错误(假设它是一个不平凡的错误,例如伪造证书而不是过期的证书)。如果您不打算正确使用 PKI 和 SSL,那为什么还要使用它呢?
标签: cocoa nsurlconnection sendasynchronousrequest