alinz / react-native-share-extension

react-native as an engine to drive share extension
MIT License
764 stars 398 forks source link

IOS NOT WORKING IN RELEASE MODE #176

Closed OmarBasem closed 4 years ago

OmarBasem commented 5 years ago

The share extension does not work on release mode on ios. In debug mode everything is working but in release mode I get the following error when I try to open the share extension: 2019-08-11 13:20:43.363617+0400 MobileSafari[15067:2525343] [core] SLRemoteComposeViewController: (this may be harmless) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} 2019-08-11 13:20:58.509647+0400 MobileSafari[15067:2525343] [UserInteraction] Tap actions button from the toolbar 2019-08-11 13:21:01.600629+0400 MobileSafari[15067:2525343] [core] SLRemoteComposeViewController: (this may be harmless) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}

I have been trying to debug for days without any success. Any help is appreciated.

jamajuice commented 5 years ago

I was having the same issue and finally got it working.

(Not sure of your exact problem, hopefully these steps help)

  1. Start by uncommenting RCTSetLogThreshold(RCTLogLevelInfo - 1); in the ShareExtensions .m file
  2. While on the .m file check in the right bar that the target membership has your Share Extension and your Main project checked.
  3. Run the Share Extension project as the main target and see if there are any errora. It could be missing libraries.
  4. Check that AppGroups are "ON" in the Capabilities tab (Xcode target) of both Main project and Share extension. For main project, container is "group." and the Share project as "group." (Entitlements are taken care of in Debug mode but not release mode - similar to this - https://stackoverflow.com/questions/52498844/app-groups-are-not-working-after-deployment-in-release-mode)
  5. I had an error saying my Share Extension was not registered (only in release). I had my setup working only when I entered another file originally instead of the main index.js, had it going into share.ios.js because originally this was the only way I could get it working. Finally, I put the AppRegistry.registerComponent('ShareExtention', () => Share) in that same index.js (one entry) file had everything working.

Hope something here helps. I'd like to hear if anyone got it working differently.

ajith-ab commented 5 years ago

I Make react-native-file-share-intent it's Work perfectly on both platforms. It supports all media to share our App

SirCameron commented 5 years ago

@jamajuice Thanks for your guide. The share extension now only runs if I run it specifically from xcode. if I run the main app, the share extension doesn't run. No log output. just nothing happens.

SirCameron commented 5 years ago

@ajith-ab please stop posting on people's issues here when they're trying to achieve something and your tool doesn't actually solve their problems.

fancydevpro commented 4 years ago

@jamajuice Thanks for your help. I had this package working on react-native 0.61.2. My problems were compile error and not working on release mode. https://github.com/alinz/react-native-share-extension/issues/182#issuecomment-534993812 and https://github.com/alinz/react-native-share-extension/issues/182#issuecomment-552941766 helped me. I made separated bundles for the main app and extension (index.js, shareex.js) b/c shared bundles didn't work with react-native-navigation v2. RNN was started in index.js and share component was registered in shareex.js (AppRegistery.registerComponent('ShareEx', () => ShareEx)), this worked on debug mode perfectly, but not on release mode. I added AppRegistery.registerComponent('ShareEx', () => ShareEx) to the main bundle file (index.js), then it started working.

OmarBasem commented 4 years ago

I ended up creating my own share extension in native code.

anasalsaadi14 commented 3 years ago

any solution ?