Pregunta

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.

¿Fue útil?

Solución 2

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.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top