How to use “fetchWithRecordID” for automatically generated ID in CloudKit Dashboard?

不想你离开。 提交于 2019-12-05 19:16:41

These are 2 different issues

  1. when querying an ID, you have to query for a CKRecordID as you did in the 2nd sample
  2. When accessing the UI, you have to do that on the main queue.

So then the code would be something like:

publicDB.fetchRecordWithID(CKRecordID(recordName: "f7080e7a-f8c3-4db6-b8ee-642a011a6762"), completionHandler: {record, error in
    if error != nil {
        println("there was an error \(error)")
    } else {
        NSOperationQueue.mainQueue().addOperationWithBlock {
            self.plasticOne.text = (record.objectForKey("subCategory") as String)
        }
   }
})
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!