I am trying to load a URLRequest in UIWebview.
I have tried with several URL. All are working fine.
But in One URL it is behaving strangely.
When I navigated to my webview It took lot of time to load this particular URL.
[self.mediaWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[@"http://www.whatmakesahighperformanceorganization.com" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ]]]];
And also It notifies me Loading and Finished loading multiple times.
- (void)webViewDidStartLoad:(UIWebView *)webView {
NSLog(@"webViewDidStartLoad...");
[self.loadingActivityView setHidden:NO];
[self.loadingActivityView startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"webViewDidFinishLoad...");
[self.loadingActivityView stopAnimating];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
NSLog(@"Error=%@",error);
}
This is the output I recieved on a single call
2012-06-19 15:25:54.255 MyApp[1957:707] webViewDidStartLoad...
2012-06-19 15:25:55.842 MyApp[1957:707] webViewDidStartLoad...
2012-06-19 15:25:55.893 MyApp[1957:707] webViewDidStartLoad...
2012-06-19 15:25:56.675 MyApp[1957:707] webViewDidFinishLoad…
2012-06-19 15:27:03.148 MyApp[1957:707] webViewDidStartLoad...
2012-06-19 15:27:09.336 MyApp[1957:707] webViewDidFinishLoad…
2012-06-19 15:27:52.661 MyApp[1957:707] webViewDidFinishLoad...
2012-06-19 15:27:52.683 MyApp[1957:707] webViewDidFinishLoad…
Check the time between 4th and 5th
Loading this URL in Chrome with the Developer Tools’ Network panel, you can see that it needs 124 requests and transfers 2.96Mb. No wonder it takes ages!