1

I have 2400 records that I added into CloudKit I was wondering if there is a way to fetch the data in a paged manner.

This is the code I have for returning the records. This works but only returns 100 results.

CKQuery * playerQuery = [[CKQuery alloc] initWithRecordType:@"Player" predicate:[NSPredicate predicateWithFormat:@"TRUEPREDICATE"]];

is there a way to change where the predicate starts from I saw some documentation saying I could use [FIRST] or something but I can find and examples and I am getting a parse error. I also tried to use @count.

Friedrich 'Fred' Clausen
  • 3,321
  • 8
  • 39
  • 70
dadougster
  • 642
  • 5
  • 9

2 Answers2

0

a CKQuery has a property resultsLimit. If you don't set that, then CloudKit will control how many records will be returned. That count can vary depending on the current load on iCloud. Just set it to your page value. Then in the queryCompletionBlock check if there is a cursor returned so that you can fetch the next page.

Edwin Vermeer
  • 13,017
  • 2
  • 34
  • 58
0

The property resultsLimit is not in CKQuery, it's in CKQueryOperation. For more see this topic.

Community
  • 1
  • 1
Oliver Eichhorn
  • 307
  • 2
  • 6