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:

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_throwglobal 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
UIWebViewcan use to decrypt the Office document before loading the URL?