UIActivityViewController: Exclude non-Apple sharin

2019-02-22 22:23发布

问题:

I would like to prevent my app to share its content to certain other apps using the extensions mechanism. For instance, I want the user to be able to share a link, but not with the Gmail app.

My understanding of the documentary is that the following should work:

// vieController previously initialised like this: UIActivityViewController(activityItems: [provider], applicationActivities: nil)

viewController.excludedActivityTypes = ["com.google.Gmail.ShareExtension"]

This doesn't work. Am I missing something? Are non-Apple activity types not working with this mechanism?

回答1:

Apparently, since iOS 8.1 this is not possible anymore (either a bug or intended behaviour), see: http://johnszumski.com/blog/excluding-third-party-apps-from-ios-8-share-sheet