Ken Chan
Ken Chan

Reputation: 21

Fetch large set using CKQueryOperation and CKReference

I have a CKReference attached to 4000 records linked to one CKRecord. They have no action (CKReferenceActionNone).
I want to be able to fetch all these records using, CKQueryOperation using NSPredicate as follows:

CKReference* recordToMatch = [[CKReference alloc] initWithRecordID:backupRecord.recordID action:CKReferenceActionNone]; NSPredicate* predicate = [NSPredicate predicateWithFormat:@"parentRecord == %@", recordToMatch];

Normally when I use CKQueryOperation I can loop it using CKQueryCursor to fetch over 100 records. But using CKReference, it works the first 100 and then 200, but after than no cursor is returned.

Is there any way to fetch 4000 records using CKReference?

Thanks a lot!

Upvotes: 0

Views: 150

Answers (1)

Clifton Labrum
Clifton Labrum

Reputation: 14158

I’m unsure if this is the exact cause of your cursor issue, but there is a limit of 750 references per record.

There is a hard limit to the number of references any one record can have. This limit is set to 750 references. Any attempt to exceed this limit will result in an error from the server.

You can see that documented here: https://developer.apple.com/documentation/cloudkit/ckrecord/reference

Upvotes: 0

Related Questions