4

How can I get a NSArray of all applicationActivities installed in the device?

- (id)initWithActivityItems:(NSArray *)activityItems applicationActivities:(NSArray *)applicationActivities;

I'd like to remove one or two items and show the rest of the full list.

ohho
  • 50,879
  • 75
  • 256
  • 383
  • Are you looking for [excludedActivityTypes](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIActivityViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIActivityViewController/excludedActivityTypes) property of `UIActivityViewController`? – iDev Dec 11 '12 at 08:57
  • http://stackoverflow.com/questions/12719931/example-of-how-to-customize-uiactivityviewcontroller-share-menu – Srikanth Dec 11 '12 at 09:23

2 Answers2

1

The activity strings are listed at the bottom of the documentation for UIActivity Class Reference UIActivity.ActivityType.

They are listed as UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, etc. These are actually strings defined in UIActivity.h.

Try this:

NSLog(@"%@", UIActivityTypePostToFacebook);

Then you can compare to these strings to display a message to the user specific to the activity type.

elarcoiris
  • 1,914
  • 4
  • 28
  • 30
Christopher
  • 5,806
  • 7
  • 31
  • 41
0

Not sure how to get list of all applicationActivities. If you want to exclude some activity types, you can use excludedActivityTypes property of UIActivityViewController. As per the documentation,

This property contains an array of strings, each of which corresponds to the value you would find in the activityType parameter of a UIActivity object. Each string you specify indicates a service that you do not want displayed to the user. You might exclude services that you feel are not suitable for the content you are providing. For example, you might not want to allow the user to print a specific image. If the value of this property is nil, no services are excluded.

This value of this property is nil by default.

iDev
  • 23,310
  • 7
  • 60
  • 85
  • 10
    This "answer" literally begins by saying "I don't know the answer." – Andrew Theken Jun 15 '15 at 15:17
  • To be fair, the question had two parts 1)get all applicationActivities 2)remove one or two activities. Since this answers second part and ohho selected that as the correct answer, I would say this is infact the correct answer to this question. So not sure why the above comment was made here. – adev Mar 01 '21 at 06:29