UIWebView - 方案未知
我需要一些帮助来处理 UIWebView
中的一些 NSData
对象。点击 UIWebView
内的链接会导致 NSLog
条目:
Scheme unkown, doing nothing: <URL>
这就是我所做的:
我启动一个外部 HTTPGetOperation
来获取 URL 请求的响应。我需要这样做是因为要处理下载文件。响应存储到 NSData
对象中。
然后,我在 HTTPGetOperation
完成时调用的方法中加载该数据:
[myWebView loadData:myNSDataObject MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
到目前为止,UIWebView
正确显示了 myNSDataObject
的内容。
但是,当我尝试点击该内容中的链接时,我会收到一个 NSLog
条目“未知方案,不执行任何操作:”以及该链接的 URL。
注意:点击链接后,不会调用 -webView:shouldStartLoadWithRequest:navigationType:
等委托方法。
注意:委托设置为 [self.myWebView setDelegate:self]
哪些方法创建该 NSLog
条目?
为什么点击链接后不调用委托方法?
有谁知道答案吗?
I need some help handling some NSData
object within an UIWebView
. Tapping a link inside UIWebView
cause a NSLog
entry:
Scheme unkown, doing nothing: <URL>
That is what I did:
I start an external HTTPGetOperation
to get a response of URL-request. I need to do so because of handling to download files. The response is stored to an NSData
object.
Then I load that data within a method that is called when HTTPGetOperation
is done:
[myWebView loadData:myNSDataObject MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
So far, UIWebView
shows the content of myNSDataObject
correctly.
But, when I try to tap a link inside that content I get a NSLog
entry "Unknown scheme, doing nothing: " with the URL of the link.
Notice: After tapping a link the delegate methods like -webView:shouldStartLoadWithRequest:navigationType:
are not called.
Notice: the delegate is set to [self.myWebView setDelegate:self]
Which methods creates that NSLog
entry?
Why are the delegate methods are not called after tapping a link?
Does anyone knows an answer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接是如何编码的?它们是 http:// 链接还是自定义的?只要链接采用标准格式,shouldStartLoadWithRequest 方法就可以测试 URL 方案以确定应如何处理它。
如果您的代表没有接到电话,那么您还有其他问题。我还建议实现 didFailLoadWithError、webViewDidFinishLoad 和 webViewDidStartLoad。
How are the links coded? Are they http:// links or are they custom? As long as the link is in standard form, the shouldStartLoadWithRequest method can test the URL scheme to determine how it should be handled.
If your delegate isn't getting called, then you have some other issue. I would also recommend implementing didFailLoadWithError, webViewDidFinishLoad, and webViewDidStartLoad.