CKModifyRecordsOperation 完成 Swift 2.0
CKModifyRecordsOperation completion Swift 2.0
我有下面的代码,但在使用 Xcode 7 和 Swift 2.0
构建时显示错误
错误是Cannot call value non-function type (([CKRecord]?, [CKRecordID]?, NSError?) -> Void)?
谢谢
let saveRecordsOperation = CKModifyRecordsOperation()
var ckRecordsArray = [CKRecord]()
// set values to ckRecordsArray
saveRecordsOperation.recordsToSave = ckRecordsArray
saveRecordsOperation.savePolicy = .IfServerRecordUnchanged
saveRecordsOperation.modifyRecordsCompletionBlock { savedRecords, deletedRecordIDs, error in
// deal with conflicts
// set completionHandler of wrapper operation if it's the case
if saveRecordsOperation.finished == true {
}
}
database.addOperation(saveRecordsOperation)
saveRecordsOperation.modifyRecordsCompletionBlock { savedRecords, deletedRecordIDs, error in
应该是
saveRecordsOperation.modifyRecordsCompletionBlock = { savedRecords, deletedRecordIDs, error in
我有下面的代码,但在使用 Xcode 7 和 Swift 2.0
构建时显示错误错误是Cannot call value non-function type (([CKRecord]?, [CKRecordID]?, NSError?) -> Void)?
谢谢
let saveRecordsOperation = CKModifyRecordsOperation()
var ckRecordsArray = [CKRecord]()
// set values to ckRecordsArray
saveRecordsOperation.recordsToSave = ckRecordsArray
saveRecordsOperation.savePolicy = .IfServerRecordUnchanged
saveRecordsOperation.modifyRecordsCompletionBlock { savedRecords, deletedRecordIDs, error in
// deal with conflicts
// set completionHandler of wrapper operation if it's the case
if saveRecordsOperation.finished == true {
}
}
database.addOperation(saveRecordsOperation)
saveRecordsOperation.modifyRecordsCompletionBlock { savedRecords, deletedRecordIDs, error in
应该是
saveRecordsOperation.modifyRecordsCompletionBlock = { savedRecords, deletedRecordIDs, error in