我有一個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