CKDatabase类只有一种方法可以将记录保存到云端。 有没有其他方法可以将多个记录保存到云端?
CKRecordID *artworkRecordID = [[CKRecordID alloc] initWithRecordName:@"116"];
CKRecord *artworkRecord = [[CKRecord alloc] initWithRecordType:@"Artwork" recordID:artworkRecordID];
artworkRecord[@"title" ] = @"MacKerricher State Park";
artworkRecord[@"artist"] = @"Mei Chen";
artworkRecord[@"address"] = @"Shenzhen";
CKContainer *myContainer = [CKContainer defaultContainer];
CKDatabase *privateDatabase = myContainer.privateCloudDatabase;
[privateDatabase saveRecord:artworkRecord completionHandler:^(CKRecord * _Nullable record, NSError * _Nullable error) {
dispatch_sync_on_main_queue(^{
if (error) {
self.titleLabel.text = @"Error";
self.subTitleLabel.text = error.description;
} else {
self.titleLabel.text = @"Successfully";
}
});
}];