As discussed here & here, it's possible to exclude other ActivityType
options using UIActivityViewController
's excludedActivityTypes
, beyond just those which are pre-defined.
However, how does one find out the identifiers for any given ActivityType
(ideally programmatically at build-/run-time, if possible), so they can then be excluded?
For example, I'm looking to disable Send to Kindle and Chrome.
To find out the ActivityType
of a third party activity, select that activity after displaying your UIActivityViewController
.
When the completion handler is called, completion closure/block you provided to the activity controller has a parameter with a type of ActivityType
telling you which one was chosen.
For example:
activityVC.completionWithItemsHandler = { activity, success, items, error in
print("activity: \(activity), success: \(success), items: \(items), error: \(error)")
}
Now you know the ActivityType
for that activity. Update your code to add that value to the list you pass to excludedActivityTypes
.