I have an iOS share extension in my react-native app.
I’m using react-native-share-menu
to implement it and I’m using a custom RN view for the share dialog as per the component documentation.
My custom share dialog works but as soon as I try to pass over to the app I get the error:
container_create_or_lookup_app_group_path_by_app_group_identifier: client is not entitled Error: Failed to get App Group User Defaults. Did you set up an App Group on your App and Share Extension?
I’m trying to test on a physical device in debug.
The app group on both my app and the extension target is the same: group.com.myapp.ios
(for ‘all’ – debug and release)
One thing I’ve noted is my target app bundle Id is different to the latter part of the group id. Does it have to match the target app bundle id?
- App =
com.myapp.ios.official
- Share Extension =
com.myapp.ios.official.share
Can anyone help? Why would my chosen group Id be problematic?
2
Answers
Just to add a bit of info here for anyone building an extension like this or using this RN component:
The group name has to be the main app bundle id prefixed by
group.
in order for data to share properly between the 2 targets.So, in the above example it should be:
group.com.myapp.ios.official
on both the app target and the extension target.This is just some added info for the self-answer @scgough gave.
The chapter and verse for that is:
Bundle Resources > Entitlements > App Groups Entitlement.
This says the OS you are targeting matters, iOS versus macOS.
Apple has an older answer that only applies to macOS:
Entitlement Key Reference, Enabling App Sandbox, Adding an App to an App Group.
For macOS the group name must be something like
DG29478A379Q6483R9214.HolstFirstAppSuite
.