Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My app inside iMessage UIActivityViewController [duplicate]

Tags:

ios

imessage

When I open attached image inside my iMessage and tap on "Share" button, I can see icons of 3rd party apps like "Path" or "Evernote". The question is: How can I add my own app to this list?

enter image description here

like image 501
rudensm Avatar asked Apr 13 '13 19:04

rudensm


1 Answers

Instead of a URL scheme you need to add a document type to your app. Try adding the following fragment to your Info.plist:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>public.jpeg</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.jpeg</string>
        </array>
    </dict>
</array>

With this fragment (specifically with the LSItemContentTypes key) you declare that your app is an editor for documents that have the Uniform Type Identifier (UTI) public.jpeg. Because this UTI is declared by the system, I believe it is not necessary that you include the UTI declaration in your app's Info.plist.

You can find all system-declared UTI's in the Apple document titled System-Declared Uniform Type Identifiers. If you are new to UTI you should probably also read the Apple document Uniform Type Identifier Concepts.

Last but not least, don't forget to consult the Information Property List Key Reference to find out what you should specify for the Core Foundation keys CFBundleTypeRole and LSHandlerRank.

BTW: This excellent SO answer also has details about working with UTIs, especially if you ever need to declare your own app-specific UTI.

like image 50
herzbube Avatar answered Oct 04 '22 03:10

herzbube