小编Dav*_*ner的帖子

UIWebView在iOS 6模拟器上正确加载内容但在设备上没有?

我在发布的应用程序中遇到了一个奇怪的错误.我的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)

uiwebview ios-simulator ios6

3
推荐指数
1
解决办法
2884
查看次数

标签 统计

ios-simulator ×1

ios6 ×1

uiwebview ×1