0

I'm just looking for a way to have my app proposed in the "Open with" menu. I saw this StackOverflow topic on the subject, I set the necessary lines in the plist file but my app is still not proposed. How can I do this ?

Here is the code I set in the plist :

<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>Owner</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>Owner</string>
            <key>LSItemContentTypes</key>
            <array>
                    <string>public.png</string>
            </array>
        </dict>
</array>

and

<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>
Community
  • 1
  • 1
Seb
  • 545
  • 9
  • 29
  • Unless you post the details of what you added to your Info.plist, there is no way for anyone to help you determine why it isn't working. – rmaddy Feb 24 '13 at 22:36

1 Answers1

4

It looks like all you did was copy those entries from the other answer you linked to.

For PDF files and PNG images you don't need the second part (imported declarations) at all. Those are well known document types.

For the document types, I just do this:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>PDF</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.adobe.pdf</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>PNG</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.png</string>
        </array>
    </dict>
</array>
rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • I just have to duplicate the last dict and change PNG with JPG in order to also include jpg files ? – Seb Feb 25 '13 at 09:14
  • What function is called at the opening of the app : - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url ou - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions ? – Seb Feb 25 '13 at 10:18
  • @Seb Read the docs for those two delegate methods. The docs tell you which is called. If you want to also support JPG then yes, copy the PNG block then change `PNG` to `JPG` and change `public.png` to `public.jpeg`. – rmaddy Feb 25 '13 at 17:33
  • 1
    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:18