以下のコードはiPhoneで動作しています。iPadでのWebビューの読み込みに問題があります。didFailwithエラーが発生します(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];
}