Open .msg and .eml files from iOS UIWebview

☆樱花仙子☆ 提交于 2019-12-22 00:16:48

问题


I am trying to display .msg and .eml files using iOS sdk 5.1 in a UIWebView. I have the files in a binary format (NSData). I am able to display doc, docx, ppt, pptx, xls, xlsx, pdf, png, bmp and jpg files in the UIWebView but not the .msg and .eml files.

Are msg and eml files supported by UIWebView? If not, is there some other way to display such files? They open fine from the Mail app.

I am getting the following error from webView:didFailLoadWithError:

2012-08-09 15:59:03.851 HelloWorld[5848:707] Error loading attachment Error Domain=WebKitErrorDomain Code=102 "Frame load interrupted" UserInfo=0x132f3ec0 {NSErrorFailingURLKey=file:///var/mobile/Applications/E959949D-1487-4AD5-A5AA-E6F678BD9D63/Documents/Your%20New%20Daily%20Edition.msg, NSErrorFailingURLStringKey=file:///var/mobile/Applications/E959949D-1487-4AD5-A5AA-E6F678BD9D63/Documents/Your%20New%20Daily%20Edition.msg, NSLocalizedDescription=Frame load interrupted}


回答1:


.MSG and .EML files aren't supported by UIWebView. I haven't seen any objective C libraries for either, but mimetic is a free C++ library that can do the job for EML files (and presumably MIME-compliant MSG files). If you haven't mixed the languages before, this article reviews the important stuff.

I haven't seen any non-Windows (Vbasic or C#) libraries for MSG files, and I understand they're difficult to parse because Outlook acts slightly differently on each version. (I'd love to be proven wrong here.)



来源:https://stackoverflow.com/questions/12029632/open-msg-and-eml-files-from-ios-uiwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!