2 Replies
      Latest reply on Nov 24, 2019 10:01 AM by pittsylvania
      Ruppert20 Level 1 Level 1 (0 points)

        I am trying to load a list from cloud kit and getting a "Field 'recordName' is not marked queryable". The record type list is queryable. The field recordName is a system generated field that I cannot modify in the cloudkit dashboard. What can I do to load these items?

         

         

        let predicate: NSPredicate = NSPredicate(value: true)

                let query: CKQuery = CKQuery(recordType: "List", predicate: predicate)

                tView.text = "Fetching Icloud data"

                db.perform(query, inZoneWith: nil) { (records: [CKRecord]?, error: Error?) in

                    if error != nil || records == nil{

                        print("Error in load: \(error!)")

                        return

                    } else{

                        var aList:[String] = []

                        for i in 0..<records!.count{

                            let record:CKRecord = records![i]

                            aList.append(record.object(forKey: "item") as! String)

                        }

                        print("Records: \(records!)")

                        OperationQueue.main.addOperation {

                            self.tView.text = aList.joined(separator: "\n")

                        }

                    }

                }

        • Re: "Field 'recordName' is not marked queryable" error when accessing cloud kit data
          captainLong Level 1 Level 1 (0 points)

          I had the same problem running the Apple CloudKit sample application :"CloudPhotos". The app does not run properly because it gets the error while doing the initial fetch for photos from the public database.

           

          the error is:

           

          APLCloudManager ERROR [CKErrorDomain:12] Field 'recordName' is not marked queryable, Error Domain=CKInternalErrorDomain Code=2015 "Field 'recordName' is not marked queryable"

           

          then the app (on iPhone or OSX) misbehave (crash), but it is because of weak error handling due to the error above.

           

          In the dashboard, at first I could not add the index for recordName in the public database, I was getting an OP LOCK error, but after using the dashboard itself to make queries, using filters and confirming that I had some records, a couple hours into it, I was finally able to add the index, and then everything worked!


          So, you should be able to make the recordName queryable in the dashboard, and then I suppose your code will work!