您好所有CloudKit
位用户:
我有一段可怕的时间试图找出为什么CKDatabaseOperation
不会给出任何反馈。在蜂窝电话上保存CKRecords
时没有错误,也没有回调。
请您告诉我您对此有何看法?
答案 0 :(得分:6)
Apple开发者论坛中有人找到了解决方案: https://forums.developer.apple.com/thread/20047
设置qualityOfService = .UserInitiated
示例:强>
let publicDB = CKContainer.defaultContainer().publicCloudDatabase
let operation = CKModifyRecordsOperation(recordsToSave: [aRecord], recordIDsToDelete: nil)
operation.allowsCellularAccess = true
operation.qualityOfService = .UserInitiated // <----- THATS THE CELLULAR FIX
operation.perRecordProgressBlock = {(record, progress) in
print("Progress: \(Int(progress*100.0))%")
}
operation.perRecordCompletionBlock = {(record, error) in
print("Upload complete") //Add awesome error handling here
}
publicDB.addOperation(operation)