IOS Share vs Action App Extension

iosios8ios8-extensionios8-share-extension

I want to implement an app extension, but I can't decide if I should implement it as a Share Extension or Action Extension.

The documentation doesn't say much about the differences, just this:

  • Share (iOS and OS X): Post to a sharing website or share content with others
  • Action (iOS and OS X; UI and non-UI variants): Manipulate or view content originating in a host app

Are there technical differences as well (e.g. does an Action extension allow me to do something that the Share extension doesn't), or is it merely a convention Apple wants you to follow to make things less confusing to users?

It seems that at least one difference is that if you want a non-UI action, you must choose an Action instead of Share extension.

What are the other differences?

Examples of things I'm looking for:

  • Do they both allow me to customize the UI?
  • Do the both give me some default UI to use?
  • Do they both have the same permissions, or am I allowed to do more things in one vs. the other?
  • Do they both receive the same input from the Host app?
  • Can they both send back the same data to the Host app?

Best Answer

Here are my findings so far:

Summary:

  • Icon: Share extensions have colored icons.
  • Icon location: Some apps, like Safari, have a large amount of un-hiddable activity icons that your icon would be competing with.
  • User Interface: Share extensions should have a consistent UI.
  • Intent: Share extensions are meant to be reserved for sharing content, but even Apple violates this requirement.

Icon

Share extensions get a colored icon, which is the same one as your app's main icon. In fact, Apple states: "If you provide a separate icon in your Share extension target, Xcode ignores it."[B]

Action extensions use "a monochromatic version of the app icon,"[E] or "a template image version"[B] of your app icon.

enter image description here


Icon location

Share extensions appear in the middle row, action extensions appear on the bottom row.

Depending on the app being targeted, your icon may be competing with more or less icons as an share vs. action extension. For example, if users are going to access your extension through Safari mainly, your app would be competing with 4 other icons by default as a share extension*, or 8 other icons as an action extension. On the other hand, if you are targeting the Maps app, you would be competing with more icons as a share extension (4) rather than an action extension (2).

Therefore, to maximize your exposure to the user you would want to choose a share extension when targeting Safari, but an action extension when targeting Maps.

Note: Most of the activities are provided by the host app itself using the UIActivity and UIActivityViewController APIs. There is a great write-up about them on NSHipster.

*Obviously the number of share and activity extensions change depending on the installed apps and which the user chose to show/hide.

Examples from the iOS 9.1 Simulator:

  • Contacts:
    • Share (1): Mail
    • Activities (0):
  • Maps:
    • Share (4): Mail, Reminders, Twitter, Facebook
    • Activities (2): Add to Favorites, Print
  • News:
    • Share (4): Mail, Reminders, Twitter, Facebook
    • Activities (5): Add to Reading List, Copy, Open in Safari, Report a Concern, Mute Channel
  • Photos:
    • Share (4): Mail, Twitter, Facebook, Flickr
    • Activities (6): Copy, Slideshow, Hide, Assign to Contact, Use as Wallpaper, Print
  • Safari:
    • Share (4): Mail, Reminders, Twitter, Facebook
    • Activities (10): Add to Favorites, Add Bookmark, Add to Reading List, Add to Home Screen, Add to Shared Links, Add to News, Copy, Print, Find on Page, Request Desktop Site
  • (Highlighted Text):
    • Share (3): Mail, Twitter, Facebook
    • Activities (1): Copy

(Italics means the icons can be hidden.)


User Interface

The default Share extension template comes with a subclass of SLComposeServiceViewController to keep things consistent. And Apple wants you to "use the system-provided UI in a Share extension [as much as possible]."[E]

Action extensions, on the other hand, allow you to choose an Action Type (Presents User Interface or No User Interface), with the former coming with a blank UIViewController.

enter image description here enter image description here
Default share extension; Default Presents User Interface Action extension.


Intent

Although Apple states that a Share extension should "post to a sharing website or share content with others,"[A] even they violate this requirement with Reminders.

Action extensions are meant to "manipulate or view content originating in a host app."[A]


Things that are the same

  • Both allow your app to provide multiple versions of the extension. (E.g. your app could provide two share extensions and two action extensions.)
  • In my limited testing, they both seem to be disabled by default, with the user having to explicitly tap on the more button to enable the share/action extension.

References