我正在尝试在 UIWebview 中加载 URLRequest。
我试过几个网址。一切正常。但在一个 URL 中,它的行为很奇怪。当我导航到我的网络视图时,加载这个特定的 URL 花了很多时间。
[self.mediaWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[@"http://www.whatmakesahighperformanceorganization.com" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ]]]];
它还多次通知我正在加载和完成加载。
- (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);
}
这是我在一次通话中收到的输出
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…
检查 4 号到 5 号之间的时间