Search code examples
iosswiftswift3

excludedActivityTypes doesn't work in Swift 3


I am working on my image iOS application and I just added an image share button and I wanted some features of Share types to be excluded but when I run in the simulator, all the features are there.

Here is my code...

let image = UIImage("b3")
let imageToShare = [image!]
let shareImage =  UIActivityViewController (activity items:imageToShare,application Activities:nil)
shareImage.popoverPresentationController?.sourceView = self.view
self.present (shareImage,animated:true,completion:nil)
shareImage.excludedActivityTypes = [UIActivityType.print,UIActivityType. copyToPasteboard]

How to exclude them ? please provide any suggestion


Solution

  • Just change the order of excludedActivityTypes on UIActivityViewController

    Like this:

    shareImage.excludedActivityTypes = [UIActivityType.print,UIActivityType.copyToPasteboard]
    self.present (shareImage,animated:true,completion:nil)