DreamBit
DreamBit

Reputation: 11

How do I associate image/video file types with an iOS application?

I'm trying to add the option "open with" to my app... I tried to get help from here at stackoverflow and other topics and tutorials but didn't succeed..

I opened a new project, added a new Document Type like this:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array>
            <string>icon.png</string>
            <string>[email protected]</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>Open All Files</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.content</string>
            <string>public.data</string>
            <string>public.audiovisual-content</string>
            <string>public.image</string>
            <string>public.jpeg</string>
            <string>public.jpeg-2000</string>
            <string>public.camera-raw-image</string>
            <string>public.png</string>
        </array>
    </dict>
</array>

then I ran the app with the simulator and with my iphone but I just can't open other photos with my app..

What am I doing wrong?

Upvotes: 1

Views: 1496

Answers (1)

Mahanthesh Kumbar
Mahanthesh Kumbar

Reputation: 501

Check the modified plist content below

<key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>PDF Document</string>
            <key>CFBundleTypeRole</key>
            <string>Viewer</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>com.adobe.pdf</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeName</key>
            <string>PNG image</string>
            <key>CFBundleTypeRole</key>
            <string>Viewer</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.png</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeName</key>
            <string>JPEG image</string>
            <key>CFBundleTypeRole</key>
            <string>Viewer</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.jpeg</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeIconFiles</key>
            <array/>
            <key>CFBundleTypeName</key>
            <string>Generic Image</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.image</string>
            </array>
        </dict>
      </array>

Upvotes: 1

Related Questions