1

I did some research but seems still no luck

when I added these xml in my info.plist

<key>UTImportedTypeDeclarations</key>
    <array>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>public.data</string>
            </array>
            <key>UTTypeIdentifier</key>
            <string>my.custom.uti</string>
            <key>UTTypeDescription</key>
            <string>PDF file</string>
        </dict>
    </array>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.data</string>
            </array>
            <key>CFBundleTypeIconFile</key>
            <string>Icon.png</string>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleTypeName</key>
            <string>my.custom.uti</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
        </dict>
    </array>

and I send 3 email to myself. 1 - pdf file. 2 - png file. 3 - jpg and png file.

when i added these xmls, my app can shows in pdf and txt file, when clicked "open with..." but what I want is open with in images. anything goes wrong?? and I set UITTypeConformsTo = public.data suppose that it is a general value. So that my app can open all the formats(at least pdf and images) , but seems it dont.

I also try to copy the xml in this answer to my info.plist https://stackoverflow.com/a/11609935/1061074 still no luck

Community
  • 1
  • 1
Siu Chung Chan
  • 1,686
  • 1
  • 14
  • 31

2 Answers2

0

In my app, I don't use key UTImportedTypeDeclarations. You can remove it and try with below:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.image</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>OpenDocument Text</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>org.oasis.opendocument.text</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>GIF image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.compuserve.gif</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>PNG image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.png</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>TIFF image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.tiff</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>JPEG image</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.jpeg</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Rich Text</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.rtf</string>
            <string>com.apple.rtfd</string>
            <string>com.apple.flat-rtfd</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Text</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.text</string>
            <string>public.plain-text</string>
            <string>public.utf8-plain-text</string>
            <string>public.utf16-external-plain-​text</string>
            <string>public.utf16-plain-text</string>
            <string>com.apple.traditional-mac-​plain-text</string>
            <string>public.source-code</string>
            <string>public.c-source</string>
            <string>public.objective-c-source</string>
            <string>public.c-plus-plus-source</string>
            <string>public.objective-c-plus-​plus-source</string>
            <string>public.c-header</string>
            <string>public.c-plus-plus-header</string>
            <string>com.sun.java-source</string>
            <string>public.script</string>
            <string>public.shell-script</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeName</key>
        <string>PDF</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.adobe.pdf</string>
        </array>
    </dict>
</array>
Hoàng Toản
  • 861
  • 9
  • 11
  • 2
    Thanks so much, but still no luck. Am I doing it right?? 1. copy those XML to info.plist 2. run my application 3. go the Photos in iPhone(or simulator) click the export button 4. to see if my app is there. it turns out that my application is not on the list. Any idea?? – Siu Chung Chan Mar 24 '15 at 08:39
0

It all depends on how "share" button in the host app is implemented. In iOS8, there are actually two different ways to do this: (1) using CFBundleDocumentTypes in Info.plist, and (2) Application Extension. Some apps such as GMail & AVR support both (1) & (2). But Dropbox supports (2) only. That's why CFBundleDocumentTypes does not work in Dropbox anymore. Of course, things may change later.

Wonka Gollum
  • 79
  • 1
  • 6
  • I am just trying to share text in my App and that is not working with CFBundleDocumentTypes. Can you help out on this I am testing on Simulator iOS 9.1 – nadeem gc Nov 17 '15 at 11:23