2

I am using the "OpenIn" functionality and opening files from web browser into my application. All the file types are registered and they work fine. When tried to open docx, pptx or other file from web browser, the "Open In" box did not show my application name. Though I can view a docx or pptx file within my application by using UIDocumentInteractionController. I dont know where the problem lies as its working very fine.

Any suggestions are welcome. Thanks for help in advance

Samuel
  • 75
  • 1
  • 9
  • which method did you use? presentPreviewAnimated or presentOpenInMenuFromRect: inView: animated: ? – Dee Jun 12 '12 at 11:28
  • refer https://developer.apple.com/library/ios/#qa/qa2008/qa1630.html – Maulik Jun 12 '12 at 11:35
  • - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation – Samuel Jun 13 '12 at 03:05
  • - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation and presentOpenInMenuFromBarButtonItem: animated: I have used the above two functions. But the problem I'm stuck with is that, when I open a docx file in Safari browser it shows me the "OpenIn" button but does not display my app name. But for doc and other files it shows my app name in "OpenIn". – Samuel Jun 13 '12 at 03:12

3 Answers3

16

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

Sample:

    <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>
Vyacheslav K
  • 161
  • 1
  • 3
0

In your app's info.plist, you would have added something similar to the following, to allow your app to open, say a PDF file, right?

enter image description here

Just replace the above with this,

enter image description here

Notice here, that the Document Content Type UTIs has been changed to public.item, which is what UTIs such as ppt, doc etc. conform to.

Hence now, you should be able to get the "Open in.." option for pdf, doc, docx, ppt, pptx, xls, xlsx.

Breakpoint
  • 1,511
  • 1
  • 18
  • 41
-1

UIWebView does not support the file formats of MS Office 2007 onwards i.e. docx,pptx,xlsx because of the file architecture.

Farrukh Javeid
  • 634
  • 6
  • 25
  • 1
    Well it does support MS Office 2007 file formats. If I add a docx or pptx file on the server side and then sync my app with the server it shows me the docx file. On clicking the file it gets displayed in the web view. The only problem I'm facing is when I am trying to open a file form web browser (safari) it shows the "Open In" button, but does not show my application name – Samuel Jun 13 '12 at 03:09
  • Well that is my mistake then. As per my experience last time, I could not get it opened in the .docx file format but when I converted it into .doc file it went fine. – Farrukh Javeid Jun 13 '12 at 06:54