In CloudKit, I tried to save a large number of records by batch processing. However, my app crashed with the following error:
Error pushing local data: <CKError 0x15a69e640: "Limit Exceeded" (27/1020); "Your request contains 561 items which is more than the maximum number of items in a single request (400)">
This is my code:
CKModifyRecordsOperation *modifyRecordsOperation = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:localChanges recordIDsToDelete: localDeletions];
modifyRecordsOperation.savePolicy = CKRecordSaveAllKeys;
modifyRecordsOperation.modifyRecordsCompletionBlock = ^(NSArray *savedRecords, NSArray *deletedRecordIDs, NSError *error) {
if (error) {
NSLog(@"[%@] Error pushing local data: %@", self.class, error);
}
};
[privateDatabase addOperation:modifyRecordsOperation];
If I get to fetch a record, it seems all can be obtained by setting the resultsLimit
in CKQueryOperation
.
https://stackoverflow.com/questions/24191999/cloudkit-count-records
https://forums.developer.apple.com/thread/11121
When I want to save a large number of records in the batch processing using CKModifyRecordsOperation
, is there any way to eliminate the limit?