0

I have an app I need to display only facebook,twitter and email in activityview controller?

everything need exclude.

How can I do that?

any help will be appreciated.

Maulik shah
  • 1,664
  • 1
  • 19
  • 45

1 Answers1

3

To exclude everything:

NSArray *exclude = @[UIActivityTypePostToFacebook,
                     UIActivityTypePostToTwitter,
                     UIActivityTypePostToWeibo,
                     UIActivityTypeMessage,
                     UIActivityTypeMail,
                     UIActivityTypePrint,
                     UIActivityTypeCopyToPasteboard,
                     UIActivityTypeAssignToContact,
                     UIActivityTypeSaveToCameraRoll,
                     UIActivityTypeAddToReadingList,
                     UIActivityTypePostToFlickr,
                     UIActivityTypePostToVimeo,
                     UIActivityTypePostToTencentWeibo,
                     UIActivityTypeAirDrop,
                     UIActivityTypeOpenInIBooks];

activityViewController.excludedActivityTypes = exclude;

Remove Facebook, Twitter and Mail from the list to show them in the action sheet.

norders
  • 1,160
  • 9
  • 13
  • need to show only facebook,twitter and email... other third party don't want to display – Maulik shah Feb 06 '17 at 07:47
  • Just exclude items that you want to show in list from that array. @Maulik – iPeter Feb 06 '17 at 07:49
  • I think I see your problem - only iOS integrated services are 'excludable' using `excludedActivityTypes`. Therefore other apps (WhatsApp, LinkedIn, Instagram) will not be excluded. The array seems to be a list of share extension bundle IDs (e.g. Messages has identifier `com.apple.UIKit.activity.Message`). If you know the identifiers of the other apps you want to exclude, you _might_ be able to add them to the list. I haven't tried this, so not sure if it will work. – norders Feb 06 '17 at 08:09
  • Have just tried excluding 'com.linkedin.LinkedIn.ShareExtension' (which is the ActivityType that gets returned when you share with LinkedIn) and can confirm it does NOT work. I think you'll have to roll your own and integrate with the FB, Twitter and mail SDKs. – norders Feb 06 '17 at 08:38