Core Data, CloudKit - Failed to find matching objectIDs for CKRecordID

I am using CloudKit to sync my app across devices. At first everything seems to work as expected but after a while CloudKit seems to get caught in an endless loop and the debug console throws tons of these messages (several thousands in serial):

CoreData: debug: CoreData+CloudKit: -[PFCloudKitSerializer applyUpdatedRecords:deletedRecordIDs:toStore:inManagedObjectContext:onlyUpdatingAttributes:andRelationships:madeChanges:error:]_block_invoke(1018): Failed to find matching objectIDs for <CKRecordID: 0x60000330c000; recordName=1E0972A7-D9DD-44A7-88F9-3AD13B32A330, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> / <CKRecordID: 0x60000330c020; recordName=EE02B981-E54D-486B-95A1-AC0839671C27, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> in pending relationship: 0xe92e2f9c5a6d27e2 x-coredata://75AFDFFD-8E35-4B9F-AA61-C477073B435B/NSCKImportPendingRelationship/p8626

I guess the most important part is:

Failed to find matching objectIDs for <CKRecordID: 0x60000330c000; ...

It's just a standard CloudKit implementation without any fancy custom code. I am not able to find anything about it in documentation. Therefore I have no idea where to start to investigate or if this is expected behaviour. I feel like this is slowing down my CloudKit sync quite a lot when I let the app run, the debug messages never end to appear.

Usually I'm expecting No more requests to execute. to appear at some point but even after hours this is not the case.

Does someone have similar issues or any idea about that?

Post not yet marked as solved Up vote post of wildcard49 Down vote post of wildcard49
1.3k views

Replies

I'm facing the exact same issue. Tons of messages like yours. Initial sync of a dataset containing ~10.000 records (and ~100MB on disk) takes 15 minutes while the CPU hits over 100%. Honostly, it makes me reconsidering the choice to use CloudKit as the cloud-backed datastore. I talked with several engineers from Apple, both during WWDC as well as DTS, but didn't got anything useful. Hoping this thread is going to be a push in the right direction.

  • Honostly, it makes me reconsidering the choice to use CloudKit as the cloud-backed datastore.

    I feel you. The more I deal with CloudKit, the more it gives me an unreliable feeling.

Add a Comment

I just found the issue on my side. During further investigation I realized that these messages came together with other messages referring to one specific entity. I preload Core Data from a json file with some data which eventually change from time.

For development purposes each time the app launches,I update my preloaded data from the json file

It turned out that I created new objects during that update to run a comparison and forgot to delete the unnecessary objects right after. Since that update process creates several hundred objects, that adds up quite fast. They were now floating around in core data without any purpose. And CloudKit had to sync them.

However, at the end it's still quite small string data and why this causes into those cryptic debug messages and hours of syncing, is still a mystery for me.

  • So essentially your solution was deleting the unnecessary objects? Hence, in a scenario you would have thousands of objects that aren't unnecessary, you would still experience this issue?

Add a Comment

I created a huge data store while I've been building with Xcode.

On one of my devices, I downloaded the TestFlight version.. which runs the prod version of CloudKit db. I assume thats the trouble but yeah now I get thousands and thousands of

CoreData: debug: CoreData+CloudKit: -[PFCloudKitSerializer applyUpdatedRecords:deletedRecordIDs:toStore:inManagedObjectContext:onlyUpdatingAttributes:andRelationships:madeChanges:error:]_block_invoke(1021): Failed to find matching objectIDs for <CKRecordID: 0x2823541c0; recordName=BFE5B0E0-E4BC-4151-B64F-771AF271DE6C, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> / <CKRecordID: 0x2823542c0; recordName=B342EDDF-8F2A-4496-B5AB-BEF29AF4018C, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> in pending relationship: 0x9eebd60aabec84c2 <x-coredata://1DE90E1A-C7CF-4963-B10F-60142BFFCFD7/NSCKImportPendingRelationship/p11489>

After trying to reinstall it via Xcode

I created a huge data store while I've been building with Xcode. On one of my devices, I downloaded the TestFlight version.. which runs the prod version of CloudKit db. I assume thats the trouble but yeah now I get thousands and thousands of CoreData: debug: CoreData+CloudKit: -[PFCloudKitSerializer applyUpdatedRecords:deletedRecordIDs:toStore:inManagedObjectContext:onlyUpdatingAttributes:andRelationships:madeChanges:error:]_block_invoke(1021): Failed to find matching objectIDs for <CKRecordID: 0x2823541c0; recordName=BFE5B0E0-E4BC-4151-B64F-771AF271DE6C, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> / <CKRecordID: 0x2823542c0; recordName=B342EDDF-8F2A-4496-B5AB-BEF29AF4018C, zoneID=com.apple.coredata.cloudkit.zone:defaultOwner> in pending relationship: 0x9eebd60aabec84c2 <x-coredata://1DE90E1A-C7CF-4963-B10F-60142BFFCFD7/NSCKImportPendingRelationship/p11489> After trying to reinstall it via Xcode