3

I have the code below but I am shown an error when building with Xcode 7 and Swift 2.0

The error is Cannot call value non-function type (([CKRecord]?, [CKRecordID]?, NSError?) -> Void)? Thanks

                    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)
4

1 回答 1

7
saveRecordsOperation.modifyRecordsCompletionBlock { savedRecords, deletedRecordIDs, error in

应该

saveRecordsOperation.modifyRecordsCompletionBlock = { savedRecords, deletedRecordIDs, error in
于 2015-09-01T18:18:31.957 回答