使用CKRecord查询返回原始数据

时间:2016-08-12 18:04:30

标签: ios swift cllocation ckrecord

将位置上传到云端套件后,我希望能够将它们作为CLLocations下载到阵列中。截至目前,我获得了CKRecords,但不能再将它们用作CLLocations了。

func loadLocation()
     {
        let locations = [CKRecord]()
        let publicData1 = CKContainer.defaultContainer().publicCloudDatabase
        let query1 = CKQuery(recordType: "location", predicate: NSPredicate(format: "TRUEPREDICATE", argumentArray:nil))
        publicData1.performQuery(query1, inZoneWithID: nil) { (results: [CKRecord]?, error: NSError?) -> Void in
            if let locations = results
            {
                self.locations = locations
                print(locations)
            }
        }
     }

0 个答案:

没有答案