UIWebView Loading content properly on iOS 6 simulator but not on device?
- by David Hegner
I have encountered a weird bug with a released app. My UIWebView is no longer loading content on iOS 6, yet the content still displays in the simulator. The activity indicator displays properly but then it loads a blank url? Again, this only happens on a device, not on the simulator.
To provide extra context (in the simulator the NSURLRequest is assigned the proper URL. When run on a device the value is nil.)
Here is my code :
-(void)loading
{
if(!self.webView.loading)
[self.activityIndicator stopAnimating];
else {
[self.activityIndicator startAnimating];
}
}
- (void)viewDidLoad
{
[self.webView addSubview:self.activityIndicator];
NSURLRequest *requestUrl = [NSURLRequest requestWithURL:self.url];
[self.webView loadRequest:requestUrl];
self.timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(loading) userInfo:nil repeats:YES];
[super viewDidLoad];
NSLog(@"%@", requestUrl);
}