CloudKit CKQueryOperation - all rows not returned

I’ve patterned my code after the Beginning CloudKit Video # 8 Operations. I have 2 small tables on the Cloud, Authors with about 100 rows and Books with about 375. Six to eight columns in each table, so nothing large in terms of storage.

As in the video I’ve implemented queryOperation.queryCompletionBlock and can see for each table it executes 8-10 times…but never returns all the rows. For Authors I might get 40 out of 100 & Books is almost consistently 168 out of 375. No errors

resultsLimit parameter appears to make no impact

The Books table is roughly in alphabetic order by author, if I select on an A - C author I’ll get all books, but for an W-Z author, nothing & no errors… so even a subset of the rows does not always work.

If I were downloading thousands of rows I might expect Apple to cap the request… but these are small tables?
I’m stuck, would appreciate comments

@bdmoakley @vegetarianzombie Can you please help with this when you get a chance? Thank you - much appreciated! :]

It sounds like you are running into the query limit. Apple tends to cap things out around a hundred or so rows, but they be may be capping returned rows based on server load. That’s just a guess. Are you opposed to working with the query cursor? Cheers!

Brian, 1st I enjoy your presentations! After trying several query cursor designs from you and StackOverflow I got suspicious about them working for others and not for me. Yesterday I was on CloudKit Console and got some weird query errors when revisiting my data in my problem table. One table I’d get all 90 rows back. So I tripled the rows in that table and they still all returned. My problem table still does not work…based on the Console error I think it’s data. I populated from an export from Excel to JSON and then wrote an import routine to populate CloudKit. While no errors in the app, I think it’s a data content issue. Going to revisit my data, albeit it’s just Strings & Ints. Will update my findings, appreciate your response. Jake

Ah - that’s very interssting. Definitely let us know what you ultimately discover. Good luck!

Brian Thanks again for your advice. Looks like I had bad data. Might have been a cut/paste from Excel to the JSON converter. When I imported from a CSV file to the JSON converter and ran the JSON back through my Xcode import to CloudKit, my fetch got all the rows! My confidence is restored!

This topic was automatically closed after 166 days. New replies are no longer allowed.