我在发布的应用程序中遇到了一个奇怪的错误.我的UIWebView不再在iOS 6上加载内容,但内容仍然显示在模拟器中.活动指示器显示正常,但然后加载空白网址?同样,这只发生在设备上,而不是模拟器上.
为了提供额外的上下文(在模拟器中,为NSURLRequest分配了正确的URL.当在设备上运行时,值为nil.)
这是我的代码:
-(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);
}
Run Code Online (Sandbox Code Playgroud)