【发布时间】:2009-11-30 07:36:32
【问题描述】:
我有一个带有一个链接的 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
有什么不同的想法吗?
【问题讨论】:
-
您告诉我们您有错误但没有发布错误?什么错误?
-
对不起。刚刚更新了问题。
标签: iphone cocoa-touch uiwebview