3
votes

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);
}
2

2 Answers

5
votes

I had a similar issue with our web app (HTML+JS+CSS) not loading on a device, but working fine in a browser and iPhone Simulator. The cause of the issue was the wrong case in filenames. E.g., HTML file wanted to load a file 'Loader.js', whereas its name was 'loader.js'.

So, maybe you should check your 'self.url' (if your 'index.html' has the right case in its filename).

0
votes

please use web view in nib and debug it to safari developer tools, so you can trace the actual problem. I use this approach for my application and its working. process to open developer tools 1-open safari 2-go to preference 3-go to advance option 4- set on to developer tools After follow above process you can see your safari having option develop. it means your safari developer tools is active and you can able to debug ios application