Sometimes my application works fine, but sometimes it fails with this error:
* WebKit has thrown an uncaught exception in webView: didFinishLoadForFrame: delegate: * - [__ NSArrayM objectAtIndex:]: index 6 is out of bounds [0 .. 5]
I found several other Exception Questions in WebKit, but none with NSRangeException.
My code is:
- (id) init {
myWebView = [[UIWebView alloc] init];
myWebView.delegate = self;
[myWebView stopLoading];
return self;
}
- (void)loadUrl:(NSString *)urlAddress {
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[myWebView stopLoading];
[myWebView loadRequest:requestObj];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
if (!myWebView.isLoading) {
[myWebView stopLoading];
if (selectedInfo == LOADTable) {
NSString *html = [NSString stringWithFormat:@"%@",[myWebView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"]];
[myWebView stopLoading];
[self parseTable:html];
}
}
}
Does anyone have an idea how to solve this error.
UIWebViewnot displayed on any UIView. Just for loading HTML.
Stone source
share