我有一个包含四个不同段的分段控件,并希望一次获取多个记录类型。只设法一次取一个。想要获取所有4种记录类型,使用分段控件在相应的tableviews中显示它们。无论如何都有。我是Swift和iOS的新手。
ToolStripMenuItem
答案 0 :(得分:1)
以获取更多参考资料: iCloud in Swift
func getResults(){
let container = CKContainer.default()
let privateDatabase = container.privateCloudDatabase
let predicate = NSPredicate(value: true)
let query = CKQuery(recordType: "UserDetails", predicate: predicate)
privateDatabase.perform(query, inZoneWith: nil) { (results, error) -> Void in
if error != nil {
print(error?.localizedDescription)
MBProgressHUD.hide(for: self.view, animated: true)
}
else {
print(results)
for result in results! {
self.arrayDetails.append(result)
}
OperationQueue.main.addOperation({ () -> Void in
self.tableView.reloadData()
self.tableView.isHidden = false
MBProgressHUD.hide(for: self.view, animated: true)
})
}
}
}