Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make my app appear in UIActivityViewController for text?

I would like my app to appear in the UIActivityViewController for text, in other apps. For example, when sharing from the Notes app as shown below.

enter image description here

Adding the following to the Info.plist didn't produce any visible results (in Notes, Evernote and Simplenote):

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array>
            <string>icon-text-57.png</string>
            <string>icon-text-72.png</string>
            <string>icon-text-114.png</string>
        </array>
        <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>public.rtf</string>
        </array>
    </dict>
</array>

Is this possible? How?

like image 672
hpique Avatar asked Feb 10 '14 20:02

hpique


1 Answers

Short answer: you can't.

Currently, you cannot add your app into other UIActivityViewControllers, unless you create your own UTI and the app ( Notes, Evernote and Simplenote) add code into their app to show yours.

What you are likely referring to, though, is the UIDocumentInteractionController, which is different, and there you CAN add your app, and I believe you are doing that correctly.

The things you are trying are all UIActivityViewControllers so no matter how hard you try, your app will not show up there.

Quick note to add: A good way to distinguish between is UIActivityViewControllers and a UIDocumentInteractionController is to see if "Dropbox" comes up in it. From my experience the Dropbox app has a "catch-all" UTI and can take any file so it usually comes up in nearly all UIDocumentInteractionController's. Of course, you'll need to have the app installed

like image 125
Jack Avatar answered Sep 27 '22 22:09

Jack