Swift share extension not working on device

We have a very strange issue where our share extension is failung BUT only when run once a build has been exported for distribution.

It builds fine & runs fine when run in a simulator, and if you just choose to run on a connected device in xcode


Everything appears to be signed correctly with app groups etc appropriately set. We click on a photo on the device > choose share > choose our app icon and nothing happens.


If we export the archive & then debug it attached to xcode, then we can see it falls over on the following line:

filemanager.default.containerurl(forsecurityapplicationgroupidentifier: "group.com.blah.blahshareext") //returns nil


Anyone seen anything like this before?

Answered by andycyork in 318298022

After a lot of head scracthing this turned out to be an issue with the code signing entitlements (which is sort of what i though in the first place). Even though automatic code signing was turned on, for some reason the appropraite entitlement for app groups was not set


under the target build settings > code signing > code signing entitlements there were different files specifed for debug and release configurations

the debug (entitlements-debug.plist) one had the required entitlements set, but the release one (entitlements-release.plist) was empty!

Accepted Answer

After a lot of head scracthing this turned out to be an issue with the code signing entitlements (which is sort of what i though in the first place). Even though automatic code signing was turned on, for some reason the appropraite entitlement for app groups was not set


under the target build settings > code signing > code signing entitlements there were different files specifed for debug and release configurations

the debug (entitlements-debug.plist) one had the required entitlements set, but the release one (entitlements-release.plist) was empty!

Hello! Please help resolve the issue. Faced the problem of lack of access to the object that was shared through UICloudSharingController. Access works on devices with different AppleID where the application is installed via XCode. But when publishing the application in AppStore, access does not work. Please let me know how to fix this problem?

Swift share extension not working on device
 
 
Q