开发者

How to properly deal with encrypted Word and Excel documents for viewing in a UIWebView?

I have a UIWebView that works 开发者_开发问答fine for viewing an unencrypted Word or Excel document stored in the app's local Documents folder.

I can use either:

[webView loadData:documentData MIMEType:mimeType textEncodingName:textEncoding baseURL:baseDocumentURL];

Or:

[webView loadRequest:[NSURLRequest requestWithURL:baseDocumentURL]];

In both cases, baseDocumentURL is a file:// URL pointed at a file in the app's local Documents folder.

ISSUE

If I try to view an encrypted Word or Excel document — by either -loadData:MIMEType:textEncodingName:baseURL: or by -loadRequest: — my app throws an exception and crashes.

If I view the document through a web server, via Mobile Safari, the Safari browser displays the following error message:

How to properly deal with encrypted Word and Excel documents for viewing in a UIWebView?

My own UIWebView crashes while Mobile Safari works. What am I missing in setting up my web view that is causing an exception to be thrown?


Some progress:

If I disable the objc_exception_throw global breakpoint in Xcode, then my app's web view behaves like the Mobile Safari web view, showing the same "This document is encrypted and can't be opened." error within the view.

Question:

Is there a way to send credentials or other information that my UIWebView can use to decrypt the Office document before loading the URL?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜