0

I made my own share extension and also my app sharing something with UIActivityViewController.
But it was not cool, my own share-extension shows up when I am sharing something.
So I want exclude my own share-extension, but it is not working.
I double-checked my app name, it was correct.

Here is my code.

let activityItems = [shareUrl]
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)

activityViewController.modalTransitionStyle = UIModalTransitionStyle.CoverVertical
activityViewController.excludedActivityTypes = ["com.mytest.ShareExtension"]; 
activityViewController.completionHandler = { (activityType: String?, completed: Bool) -> Void in

    print(activityType) // printed "com.mytest.ShareExtension"
}

vc.presentViewController(activityViewController, animated: true, completion: nil);
regetskcob
  • 1,172
  • 1
  • 13
  • 35
Hyesang Yu
  • 26
  • 5

1 Answers1

1

Maybe this helps. It states that subclassing the UIActivityViewController and overwriting the

- (BOOL)_shouldExcludeActivityType:(UIActivity *)activity

Method should do the trick. For me it did, and some say, it's AppStore Approved. And Swift is compatible to Objective-C via Bridging-Headers. Hope it helps.

Community
  • 1
  • 1
Sven Holzinger
  • 103
  • 1
  • 1
  • 9