8
votes

I added share extension to my iOS app project on XCode. but when I choose one photo, and choose my extension to share it, the didSelectPost() function of my ShareViewController is never called! for testing that, I juste put a breakpoint on it and added somme log print.

For information , I have one ShareViewController class created by XCode and the main storyboard and info.plist.

Thanks

breakpoint state

1
Don't show screenshot of your code, post actual code.Larme
This code is generated by XCode, in ShareViewController. Xcode do it automatically when an extension is added to your project. So i took screen shot of it because it's default code geenretade and nothing extraordinary.profskz
I found the cause of problem : I didn' have any call on didSelectPost() function beacause I should have choosen my Extension project to build and not the Main project. So I tried build myExtension as main project, and it works great.profskz
How did you do to call this function from your application? I'm doing the same thing you but that does not walk.Betcha
Hi i also have the same problem. My shareView controller methods not invoked when i click on post button of share image . Need helpAnita

1 Answers

0
votes

Taken from this Medium article https://medium.com/macoclock/ios-share-extension-swift-5-1-1606263746b

If you need to debug the ShareViewController you need to:

  1. Make sure that Product -> Scheme -> Edit Scheme -> Executable is set to Ask on Launch .
  2. Run the Target (Share-Debug) ** Don't run the main project
  3. Choose from the list an app that can share the content that you wanna test (for example Photos for images or Voices for audio.

This fixed it for me.