Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function didSelectPost() not called - iOS Share Extension

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

like image 947
profskz Avatar asked Jul 04 '26 12:07

profskz


1 Answers

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.

like image 72
adeiji Avatar answered Jul 07 '26 02:07

adeiji



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!