Reputation: 1153
I am having trouble getting my application to fetch all of one type of record and have each users record put into an array.
this is the code that saves the record
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let id = CKRecordID(recordName: "01")
let locationRecord = CKRecord(recordType: "location", recordID: id)
locationRecord.setObject(location, forKey: "location")
let publicData = CKContainer.defaultContainer().publicCloudDatabase
publicData.saveRecord(locationRecord) { record, error in
//..
}
}
Upvotes: 1
Views: 2456
Reputation: 1
NSPredicate *predicate = [NSPredicate predicateWithValue:YES]; CKQuery *query = [[CKQuery alloc] initWithRecordType:ckEventsRecord predicate:predicate];
[[CloudKitManager publicCloudDatabase] performQuery:query
inZoneWithID:nil
completionHandler:^(NSArray *results, NSError *error) {
NSLog(@"%@",results);
NSLog(@"%@",error);
[arrTemp addObjectsFromArray:results];
}];
Upvotes: -1
Reputation: 1656
CKDatabase *publicDatabase = [[CKContainer defaultContainer]];
NSPredicate *predicate = [NSPredicate predicateWithValue:YES];
CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Group_attributes"];
[publicDatabase performQuery:query inZoneWithID:nil:^(NSArray *results,error){
}];
Upvotes: -1
Reputation: 5076
You'll need to use a CKQuery
with a NSPredicate
set to true:
let predicate = NSPredicate(value: true)
let query = CKQuery(recordType: "location", predicate: predicate)
database?.performQuery(query, inZoneWithID: nil) { results, error in
//...
}
Upvotes: 5