Why Share Extension is not working on iOS 13?

Viewed 2592

I was using a Share extension in my app in order to import audio files and it was working on iOS12. Now in iOS 13 is not working anymore, when I press the share button my app doesn't appear in the share sheet. I think that maybe something has changed in the plist or similar but I coudn't find any information. Does anyone have the same problem?

NB: I don't wanna use the copy - paste strategies, only the share extension.

2 Answers

Try this for iOS 13

    DispatchQueue.main.async {

      let activityItem = URL.init(fileURLWithPath: Bundle.main.path(forResource: "audio", ofType: "mp3")!)

      let activityVC = UIActivityViewController(activityItems: [activityItem],applicationActivities: nil)
      activityVC.popoverPresentationController?.sourceView = self.view

      self.present(activityVC, animated: true, completion: nil)
    }

For IOS 13 you Should add below code inside your open url method.

UISceneOpenExternalURLOptions * options = [[UISceneOpenExternalURLOptions alloc] init];
options.universalLinksOnly = false;
Related