Search code examples
iosxcodeicloudcloudkit

Using iCloud for User Prefs by way of CloudKit


Swift 2.0, iOS9

In my App, I can save a user's prefs by way of iCloud. The first time they try to post, the data framework is setup, and the users private DB is all theirs, great, can store it all there. Fantastic!

Sounds like the Holy Grail, easy, secure, no logins, loving it, BUT when the App try's to access the saved records, this is spit back at me:

Optional(<CKError 0x12462cc60: "Invalid Arguments" (12/2015); server message = "Field '___recordID' is not marked queryable"; 

And there seems to be no one of updating in code, so how do I retrieve data from iCloud if I can't update that setting? Most be a way? thanks


Solution

  • You'll need to use the CloudKit Dashboard to mark the Record ID property of this record type as queryable.

    Select your record type and click on "Metadata Indexes". Check the Query checkbox next to the Record ID field and this error should go away.