Capacitor - Plugin for Share Extension from iOS & Android

Hi guys,

In my Cordova app i had installed the Open With plugin (https://github.com/j3k0/cordova-plugin-openwith) to transfer photos from the Android & iOS photos app to my app. In iOS the ‘Share Extension’ widget was added.
My users could ‘share’ the photos from the iOS photos app to my app by selecting multiple photos and ‘post’ them. The Custom URL scheme of my app was called and in the HandleOpenURL() function the photos were loaded into the app.

Unfortunately this plugin isn’t working in Capacitor. I tried to build it my own, by following this tutorial: https://medium.com/@abhishekthaplithapliyal/ios-share-extension-930ba1ad3c3d and got it almost working.

The user can share the photos to my app, the share extension stores the ImageData in de SharedPreferences (NSUserDefaults) and opens my app by URL scheme with a unique key (?token=…). In my app i use the Capacitor Listener for Opening Url (Deeplink) to get the opened url and token. I tried to use the Native Storage (cordova) plugin and default Capacitor storage to get the data by key (token) but unfortunately don’t receive anything.

Anyone already got this working? Thanks in advance!

Pretty sure NSUserDefaults are sandboxed to a specific app, so it wouldn’t allow for reading data set by other apps.

https://developer.apple.com/documentation/foundation/userdefaults

Do you have some sample code that you can share? Kind of hard to help debug without it.