在使用OpenInfunction的应用程序中,无法通过webbrowser打开docx文件

我正在使用“OpenIn”function,并从Web浏览器打开文件到我的应用程序。 所有的文件types都被注册,并且工作正常。 当试图从Web浏览器打开docx,pptx或其他文件时,“打开”框中没有显示我的应用程序名称。 虽然我可以通过使用UIDocumentInteractionController在我的应用程序中查看docx或pptx文件。 我不知道问题在哪里,因为它的工作非常好。

任何build议,欢迎。 提前感谢您的帮助

doc UTI:com.microsoft.word.doc

docx UTI:org.openxmlformats.wordprocessingml.document

ppt UTI:com.microsoft.powerpoint.ppt

pptx UTI:org.openxmlformats.presentationml.presentation

xls UTI:com.microsoft.excel.xls

xlsx UTI:org.openxmlformats.spreadsheetml.sheet

样品:

<dict> <key>CFBundleTypeName</key> <string>Microsoft Word 2003 XML document</string> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>LSHandlerRank</key> <string>Alternate</string> <key>LSItemContentTypes</key> <array> <string>org.openxmlformats.wordprocessingml.document</string> </array> </dict> 

在你的应用程序的info.plist中,你会添加类似于以下的东西,让你的应用程序打开,说一个PDF文件,对不对?

在这里输入图像说明

用这个replace上面的,

在这里输入图像说明

这里需要注意的是, Document Content Type UTIs已经改为public.item ,这就是ppt,doc等UTI所符合的。

因此,现在,您应该能够获得pdf,doc,docx,ppt,pptx,xls,xlsx中的“Open in ..”选项。

由于文件体系结构的原因, UIWebView不支持MS Office 2007以后的文件格式,例如docx,pptx,xlsx。