0

我想用我的UIWebView. 我已经添加了allowsAnyHTTPSCertificateForHost. 这是我的一个简单请求NSURLRequest,似乎它成功了,但我的 iPhone 中没有显示任何内容。

当我尝试使用我的 3g 连接时,会出现此日志:

void SendDelegateMessage(NSInvocation *): delegate(webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: _kCFURLConnectionPrivateRunLoopMode

我尝试添加几个代码,但没有一个起作用:

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
    return YES;
}

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
    [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
}

@implementation NSURLRequest (NSURLRequestWithIgnoreSSL)

+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
    return YES;
}

@end

对正在发生的事情有任何想法吗?我错过了什么吗?

4

0 回答 0