在 webview 上打开本地 .doc 文件时出现 NSRangeException

发布于 2024-12-18 02:48:45 字数 493 浏览 5 评论 0原文

我正在尝试在 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 的 didFailLoadWithErrorwebViewDidFinishLoad 委托都没有被调用,所以我如何捕获错误。这可能是什么原因?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳哥哥 2024-12-25 02:48:45

我以前在这里见过几个这样的问题。

如:

显示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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文