3

Possible Duplicate:
How do I associate file types with an iPhone application?

After some Googling, I found I was to change my plist file to include "Document Types" ---> an array with two values in each spot: Document Type Name, Handler Rank.

I did this and wrote public.pdf, public.png, etc... as the document type names and I tried every available handler rank. However, when I test it on the iPad, my app still will not display in the "Open in..." list.

Can anyone help me to achieve this?

Community
  • 1
  • 1
Rossi
  • 609
  • 6
  • 14

1 Answers1

9

I have not tested, but does this work for you?

Also see the following link: http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/understanding_utis/understand_utis_declare/understand_utis_declare.html

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>pdf</string>
        </array>
        <key>CFBundleTypeIconFile</key>
        <string>app.icns</string>
        <key>CFBundleTypeName</key>
        <string>public.pdf</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.pdf</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>png</string>
        </array>
        <key>CFBundleTypeIconFile</key>
        <string>app.icns</string>
        <key>CFBundleTypeName</key>
        <string>public.png</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.png</string>
        </array>
    </dict>
</array>

and this...

<key>UTImportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.data</string>
        </array>
        <key>UTTypeIdentifier</key>
        <string>public.pdf</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>com.apple.ostype</key>
            <string>PDF</string>
            <key>public.filename-extension</key>
            <array>
                <string>pdf</string>
            </array>
            <key>public.mime-type</key>
            <string>application/pdf</string>
        </dict>
    </dict>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.image</string>
        </array>
        <key>UTTypeIdentifier</key>
        <string>public.png</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>com.apple.ostype</key>
            <string>PNG</string>
            <key>public.filename-extension</key>
            <array>
                <string>png</string>
            </array>
            <key>public.mime-type</key>
            <string>image/png</string>
        </dict>
    </dict>
</array>
Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
  • Thanks for the answer! - I'll give it a shot but where did you put this code? – Rossi Jun 18 '11 at 15:49
  • Open your .plist file in a text editor (such as TextWrangler) and paste it in place of your existing `CFBundleDocumentTypes` and the ` ... ` immediately following it. Figured it would be easier to than trying to use the interface in Xcode. – Jake Petroules Jun 18 '11 at 15:51
  • It is telling me that the file has been corrupted and it can not read it... – Rossi Jun 18 '11 at 15:59
  • Sorry, that's because I missed a `` there in the middle. Just recopy the code. – Jake Petroules Jun 18 '11 at 16:07
  • I recopied the code - and no error anymore - thats slick by the way, didn't know you could do it in text editor but... still not in the popup list... – Rossi Jun 18 '11 at 16:11
  • I added a second block of code you should add after what you have already, as well as a link to some Apple documentation which may be helpful. Sorry I can't test this out before posting but I don't have the necessary equipment. Hopefully in the end this can at least help you along the way a little. :) – Jake Petroules Jun 18 '11 at 16:34
  • THAT WAS AWESOME! Thanks so much! Its in the menu, just as I had hoped. You saved the day – Rossi Jun 18 '11 at 16:41
  • Glad to have helped! Best of luck with your app. – Jake Petroules Jun 18 '11 at 18:29
  • I have tried all the methodology provided here and other places as well, but I am still struggling to get open PNG files. I am working with iOS 7. In some places they are saying that this problem starts with ios 6. Is it true? Can't we open png files in "Open in " dialog box with ios 7? – Kumar Aditya Dec 30 '13 at 10:19