簡體   English   中英

為什么UIWebView鏈接單擊錯誤?

[英]Why does UIWebView link click error out?

我有一個帶有一個鏈接的UIWebView(webview)。 我已經為此類實現了UIWebViewDelegate。 當我單擊鏈接時,頁面加載,但是出現錯誤。

- (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

有什么區別的想法嗎?

請參見UIWebView:加載URL時出錯 ,盡管我不認為_是一個奇怪的字符,但UIWebView似乎無法處理“奇怪的字符”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM