0
아래 코드가 Iphone에서 작동하고 있습니다. ipad에서 webview로드 중 문제가 발생했습니다. didFailwith 오류가 발생합니다 (iPad가 연결됨).Webview는 iphone에서 작동하지만 ipad에서는 작동하지 않습니다.
- (void)viewDidAppear:(BOOL)animated
{
NSURL *url;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
url = [NSURL URLWithString:@"http://www.google.com"];
}else{
url = [NSURL URLWithString:@"http://www.google.com"];
}
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[webSurfForecast loadRequest:req];
[super viewDidAppear:YES];
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Can't connect. Please check your internet Connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
당신이 NSError 오류 변수에 실제로 무엇을 선택 했는가? – Bastian
안녕 충분히 바스 티앙, NSError : 오류 ipad 오류 도메인 = WebKitErrorDomain 코드 = 101 "작업을 완료 할 수 없습니다. (WebKitErrorDomain 오류 101.)"UserInfo = 0x7064c50 {} – user1283153
실제로 http : //www.google.com? urlencoding하지 않고 url을 사용하는 것처럼 오류가 발생합니다. – Bastian