[iOS]code1002有关问题,get请求https的网址

[iOS]code1002问题,get请求https的网址

在 NSURLConnection 旁边添加这个方法

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

{

    if ([challenge previousFailureCount] == 0) {

        NSURLCredential *cre = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];

        [challenge.sender useCredential:cre forAuthenticationChallenge:challenge];

    }

}


版权声明:本文为博主原创文章,未经博主允许不得转载。