Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To prevent your application's share extension from appearing in UIActivityViewController, you can use the excludeActivityTypes property of UIActivityViewController. This property is an array of UIActivityType constants that allows you to exclude specific share extensions from appearing in the UIActivityViewController.

Here's an example:

let activityViewController = UIActivityViewController(activityItems: [image, text], applicationActivities: nil)
activityViewController.excludedActivityTypes = [UIActivityType.postToFacebook, UIActivityType.postToTwitter, UIActivityType.postToWeibo]

// present the activity view controller
present(activityViewController, animated: true, completion: nil)

In this example, the share extensions for Facebook, Twitter, and Weibo are excluded from appearing in the UIActivityViewController. You can replace these UIActivityType constants with the ones associated with your application's share extension to exclude it from appearing in the UIActivityViewController.

Note that this will only prevent the share extension from appearing in the UIActivityViewController, but users can still access it through other means such as the share button in your app's interface.