我有一个UIWebView(webview),其中有一个链接。我已经为这个类实现了UIWebViewDelegate。当我点击链接时,页面加载,但我得到一个错误。为什么UIWebView链接点击错误?
- (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_Class/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);
}
错误输出是:
the error is: Error Domain=WebKitErrorDomain Code=101 UserInfo=0x3814410 "Operation could not be completed. (WebKitErrorDomain error 101.)"
然而,这个链接能正常工作:http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class
任何想法的区别是什么?
你告诉我们你有错误,但没有发布错误?什么是错误? – 2009-11-30 07:38:49
对不起。刚刚更新了这个问题。 – 4thSpace 2009-11-30 07:49:46