NSPersistentCloudKitContainer - Import failed with error: Error Domain=NSCocoaErrorDomain Code=4864

The NSPersistentCloudKitContainer synchronization between core data and iCloud was working fine with phone 15.1. Connected a new iPhone iOS 15.5, it gives error:

CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](2504): <NSCloudKitMirroringDelegate: 0x28198c000>: Observed context save: <NSPersistentStoreCoordinator: 0x2809c9420> - <NSManagedObjectContext: 0x2819ad520>
2022-12-05 13:32:28.377000-0600 r2nr[340:6373] [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _importFinishedWithResult:importer:](1245): <PFCloudKitImporter: 0x2837dd740>: Import failed with error:
Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)}
CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _importFinishedWithResult:importer:](1245): <PFCloudKitImporter: 0x2837dd740>: Import failed with error:
Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)}

I go back and try with my old iPhone iOS 15.1, gives same error.

When I save a record to Coe data it gives the following error:

CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:](2678): <NSCloudKitMirroringDelegate: 0x28125aa40>: Observed remote store notification: <NSPersistentStoreCoordinator: 0x28024f870> - 62A30810-81D5-4B3E-8268-D67AC946275B - <NSPersistentHistoryToken - {
  "62A30810-81D5-4B3E-8268-D67AC946275B" = 1;
}> - file:///var/mobile/Containers/Data/Application/F31692C2-BFAC-449F-A2AD-5FEEF2DCC979/Library/Application%20Support/public.sqlite
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](2635): <NSCloudKitMirroringDelegate: 0x28125aa40>: Observed context save: <NSPersistentStoreCoordinator: 0x28024f870> - <NSManagedObjectContext: 0x281260000>
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:]_block_invoke(2731): <NSCloudKitMirroringDelegate: 0x28125aa40> - Ignoring remote change notification because it's for a different store: DCCFA919-33E0-4936-B3A7-2E5CC0375CDC / 62A30810-81D5-4B3E-8268-D67AC946275B

By the way I accidentally deleted the CD_FAKE_Contact_... record that existed in CloudKit. Is it because of that or is it because the public.sqlite path is different in the current phone than the previous phone I earlier used

NSPersistentCloudKitContainer - Import failed with error: Error Domain=NSCocoaErrorDomain Code=4864
 
 
Q