开发者

Why does UIWebView link click error out?

I have a UIWebView (webview) with one link in it. I have implemented UIWebViewDelegate for this class. When I click the link, the page loads but I get an error.

- (void)viewDidLoad {
[super viewDidLoad];
webview.delegate = self;
NSString *html = @"<html> \n"
"<head> \n"
"</head><body> \n"
"<p><b><a href='http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Cl开发者_高级运维ass/Reference/NSTimer.html'>click here</a></b></p> \n"
"</body> \n"
"</html>";
[webview loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
NSLog(@"the error is: %@", error);
}

Error output is:

the error is: Error Domain=WebKitErrorDomain Code=101 UserInfo=0x3814410 "Operation could not be completed. (WebKitErrorDomain error 101.)"

However, this link works fine: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class

Any ideas on what the difference is?


see UIWebView: Error while loading URL, it seems that the UIWebView is not capable of processing "strange characters", although I do not think that the _ is a strange character.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜