0
Я использовал UIWebview
для подключения accounts.craigslist.org , но это не сработает. Если я сменил адрес сайта на google www.google.com он работает. Я использую прокси, но я не думаю, что это проблема прокси. код нижеiPhone UIWebView Не могу подключиться Некоторые сайты
self.mWebView.delegate = self;
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLCacheStorageAllowed timeoutInterval:15.0];
[self.mWebView loadRequest:urlRequest];
Вот (я видел какое-то решение, но не работает для меня с этого сайта)
И я применил другие решения с NSURLConnectionDataDelegate
делегатом
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
return YES;
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
NSArray *trustedHosts = [NSArray arrayWithObjects:@"mytrustedhost",nil];
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]){
if ([trustedHosts containsObject:challenge.protectionSpace.host]) {
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
}
}
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
Вы можете разделить строку кода, где вы принимаете строку URL? – Janmenjaya