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

  • RT @Pinboard: A useful way to think of it: is giving to candidate X going to mean they can spend every working minute between now and November 3 campaigning, instead of on the phone fundraising? Or will it just get put on top of an existing mountain of cash, or handed straight to Facebook? 5 days ago
  • RT @zntfdr: New in Xcode 12, we can remove *all* disabled breakpoints at once! 🎉 (I've missed this one before!) pic.twitter.com/OKwIGTX128 8 days ago
  • RT @ctrlshifti: my friend hacked the former prime minister of australia and instead of selling the info on the dark web like a normal person, they spent 6 months in email chains with the gov trying to get the whole thing resolved. you can read about their adventure here twitter.com/mangopdf/statu… 9 days ago