Error when calling initializeCloudKitSchema

I am trying to setup my CloudKit schema from CoreData using the NSPersistentCloudKitContainer but getting an error when calling 

try container.initializeCloudKitSchema() 

The error:

Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={encounteredErrors=(
    "Error Domain=NSCocoaErrorDomain Code=134406 \"Request '07443E71-32AC-4E63-A163-AAF940FE1AD6' was aborted because the mirroring delegate never successfully initialized due to error: <CKError 0x60000078b9c0: \"Missing Entitlement\" (8); \"Trying to initialize a container without an application ID\">\" UserInfo={NSLocalizedFailureReason=Request '07443E71-32AC-4E63-A163-AAF940FE1AD6' was aborted because the mirroring delegate never successfully initialized due to error: <CKError 0x60000078b9c0: \"Missing Entitlement\" (8); \"Trying to initialize a container without an application ID\">}"
)}

My container is iCloud.<my bundle id>, and is reflected in the Entitlement file.

Answered by lpence in 725295022

Turns out you can't do this on a simulator, has to be a real device.

Accepted Answer

Turns out you can't do this on a simulator, has to be a real device.

Error when calling initializeCloudKitSchema
 
 
Q