I am implementing a webview based application, in that I need to find out a way when the 404 error occurred.
Anyone's help will be much appreciated.
Thanks to all, Monish.
In the webViewDidFinishLoad
method, you can also check it this way:
NSCachedURLResponse *resp = [[NSURLCache sharedURLCache] cachedResponseForRequest:webView.request];
NSLog(@"status code: %ld", (long)[(NSHTTPURLResponse*)resp.response statusCode]);
webViewDidFinishLoad()
method writes following code and checks status code...
- (void)webViewDidFinishLoad:(UIWebView *)webview {
NSCachedURLResponse *urlResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:webview.request];
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*) urlResponse.response;
NSInteger statusCode = httpResponse.statusCode;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With