11

I'm having trouble excluding custom UIActivityTypes from UIActivityViewController

I have…

extension UIActivityType {
    static let fbMessenger = UIActivityType("com.facebook.Messenger.ShareExtension")
    static let telegram = UIActivityType("ph.telegra.Telegraph.Share")
}

and then

let activityController = UIActivityViewController(activityItems: <sharingItems>, applicationActivities: nil)

activityController.excludedActivityTypes = [.postToFacebook, .fbMessenger, .telegram]
present(activityController, animated: true)

With the excluded types above, the presented share sheet correctly excludes Facebook, but still shows the 2 custom types (Messenger and Telegraph)

Interestingly, checking the activityType in completionWithItemsHandler when selecting either of the 2 that I was trying to exclude shows they do have the raw values as above.

Can custom UIActivityTypes be excluded? Any thought on what I'm missing?

Ashley Mills
  • 50,474
  • 16
  • 129
  • 160

0 Answers0