I have a CoreData model, in a Swift Package with tests.
I can successfully run the tests, when I load the model using NSPersistentContainer
, however attempting this with NSPersistentCloudKitContainer
always fails in the call to loadPersistentStores(completionHandler block: @escaping (NSPersistentStoreDescription, Error?) -> Void)
The error is : [CK] BUG IN CLIENT OF CLOUDKIT: Not entitled to listen to push notifications. Please add the 'aps-connection-initiate' entitlement.
This issue is described on StackOverflow however, the accepted solution does not appear to work in my case.
I have tried adding the aps-connection-initiate
key to my App Info.plist, the Test Info.plist and the SPM bundle. No change. (NB. adding this to the entitlements file just breaks auto signing).
I have enabled App entitlements for App Groups, Remote Notifications background mode, Push Notifications and iCloud CloudKit with a store identifier.
I have checked my model. All relationships have inverses. No unique constraints, etc. etc.
I am sharing a Bundle ID with a previous version of the App, that also uses CoreData+CloudKit, each version has it's own Model and container identifier, each container identifier is available in the provisioning profile.
The new version of the model has two NSPersistentStoreDescription
s, one is configured for CloudKit, the other is a local cache.
I am completely stuck, suggestions would be very welcome.