FAQ Database Discussion Community

performQuery, cannot set inZoneWithID to nil

Hi I am trying to make a small function that should send me back the record that corresponds to the user by entering his/her name. I created a swift file: import Foundation import CloudKit import UIKit func getGetMainUser(name : String) -> CKRecord { var myRecord : CKRecord! let container =...

CloudKit compound query (query with OR)

I would like to query CloudKit using OR with two fields. But I can't find a way how to do this. What I did is: NSPredicate *predicate1 = [NSPredicate predicateWithFormat:@"(creatorUserRecordID == %@)", userId]; NSPredicate *predicate2 = [NSPredicate predicateWithFormat:@"(toUser == %@)", userId]; NSCompoundPredicate *compPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:@[predicate1, predicate2]]; CKQuery *query =...

How to keep data from iCloud(CloudKit) loaded after switching view controllers

I am in the process of making an app using CloudKit, but I have recently run into a problem. In my app, as soon as the main view controller loads, it goes off and fetches data from iCloud. The problem is that when I segue to another view controller and...