0
私は accounts.craigslist.org を接続するためにUIWebview
を使用しているが、それは動作しませんがconnnectすることはできません。 私はサイトアドレスを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];
}
を試してみてください? – Janmenjaya