在 webview 上打开本地 .doc 文件时出现 NSRangeException
我正在尝试在 iPad 上的 UIWebview 中打开下载的 .doc 文件。 基本上 .doc 文件的文件名和文件名中都有 unicode 字符。我试图打开的文件内容。
我在控制台中收到以下错误日志
WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSRangeException> *** -[NSArray objectAtIndex:]: index 0 beyond bounds for empty array
,但是 webview 的 didFailLoadWithError 或 webViewDidFinishLoad 委托都没有被调用,所以我如何捕获错误。这可能是什么原因?
I am trying to open a downloaded .doc file in UIWebview on iPad.
Basically .doc file have unicode character in both file name & file content which i am trying to open .
I got following error logs in console
WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSRangeException> *** -[NSArray objectAtIndex:]: index 0 beyond bounds for empty array
But neither webview's didFailLoadWithError or webViewDidFinishLoad delegate is called so how can i trap the error .What could be reason for it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前在这里见过几个这样的问题。
如:
显示ppt、doc、 UIWebView 中的 xls 不起作用,但 pdf 起作用
和
UIWebView 不打开 ms word (doc) 和ms excel (xls) 文件
您可能会在这些问题中找到一些有用的提示。
当您在 Macintosh 上下载该文件时,该文件是否可以正确打开?
mime 类型设置正确吗?
您在 UIWebViewDelegate 中还实现了什么?
I've seen a few questions like this here before.
Such as:
Displaying ppt, doc, and xls in UIWebView doesn't work but pdf does
and
UIWebView does not open ms word (doc) and ms excel (xls) files
You might find some helpful hints in those questions.
Does the file open correctly when you download it on a Macintosh?
Is the mime type set correctly?
What else have you implemented in your UIWebViewDelegate?