قالب وردپرس درنا توس
Home / IOS Development / ios – Manually cast a CKErrorPriorFailure

ios – Manually cast a CKErrorPriorFailure



I am tracking a CloudKit error under & # 39; Could not change any records. & # 39;

How can I throw this error so I can test my error handling code?

Is there a property for CKRecord that I can set to force it to fail?

Code is currently something like:

  var someRecords = [CKRecord] ()
for I in (1 ... 10) {
la record = CKRecord (recordType: "Track", recordID: CKRecord.ID (zoneID: recordZone.zoneID))
...
someRecords.append (record)
}

let operation = CKModifyRecordsOperation (recordsToSave: someRecords, recordIDsToDelete: nil)

operation.modifyRecordsCompletionBlock = {savedRecords, deleteRecords, error in
DispatchQueue.main.async {
if! self.handleError (error) {...}
}
}


Source link