Excluding Third-Party Apps from iOS 8's Share Sheet

January 9, 2015

With the release of iOS 8 came many third-party Share extensions to help users move data from the current app into another. The destination app can be a social network like Tumblr, a productivity app like Dropbox, or a utility like the immensely useful Mail to Self. In some cases, the source app knows which options don't make sense and should be hidden based on the content being shared. Developers express this restriction in code by adding NSString activity type values to UIActivityViewController's excludedActivityTypes property.

Recently I needed to add share functionality to an app that showed some legalese and forms needed to complete a sign up process. Similar to how Apple provides an "Email me a copy" option in the iTunes Terms of Service dialog, the designer wanted the user to be able to consume the content in another app of their choice. For example, a PDF form could be printed or a long set of legalese could be more easily read in Instapaper or emailed to a desktop mail client. A few activity types clearly don't make sense in this scenario: sharing to social media and Assign to Contact. I looked around the web to see if someone has compiled a list of third-party activity types and had no success, so here is what I collected for the big social networks:

  • Facebook — UIActivityTypePostToFacebook or com.apple.UIKit.activity.PostToFacebook
  • Twitter (official) — UIActivityTypePostToTwitter or com.apple.UIKit.activity.PostToTwitter
  • Twitter (Echofon) — net.naan.TwitterFonPro.ShareExtension-Pro
  • Twitter (HootSuite) — com.hootsuite.hootsuite.HootsuiteShareExt
  • LinkedIn — com.linkedin.LinkedIn.ShareExtension
  • Pinterest — pinterest.ShareExtension
  • Google Plus — com.google.GooglePlus.ShareExtension
  • Tumblr — com.tumblr.tumblr.Share-With-Tumblr
  • Flickr — UIActivityTypePostToFlickr or com.apple.UIKit.activity.PostToFlickr
  • Vimeo — UIActivityTypePostToVimeo or com.apple.UIKit.activity.PostToVimeo
  • Sina Weibo — UIActivityTypePostToWeibo or com.apple.UIKit.activity.PostToWeibo
  • Tencent Weibo — UIActivityTypePostToTencentWeibo or com.apple.UIKit.activity.TencentWeibo
  • Yammer — wefwef.YammerShare
  • HootSuite — com.hootsuite.hootsuite.HootsuiteShareExt

Now that we have a list of activity types, all thats left is to add them to excludedActivityTypes and the problem is solved! Unfortunately, iOS doesn't work the way you would expect:

iOS 8.1's share sheet with Tumblr

As of iOS 8.1 UIActivityViewController ignores third-party values in excludedActivityTypes. The system options like UIActivityTypePostToFacebook and UIActivityTypePostToTwitter are okay, but anything that doesn't start with com.apple.UIKit.activity is ignored. I opened Radar #19430419 for this issue, and if you would also like this functionality please open a duplicate of it. Sample code demonstrating the bug is available on GitHub.

@jszumski

  • Amazon needs to write a Mint plugin that auto tags your transactions based on the product. It's error prone to do i… twitter.com/i/web/status/9… 18 hours ago
  • @marcoarment I always assumed that the chapter didn't line up with the beginning or end of the read because Smart S… twitter.com/i/web/status/9… 2 days ago
  • RT @nktpnd: POTUS' emotions are limiting the intelligence his briefers feel comfortable giving him, which is a recipe for disaster. https:/… 4 days ago