paulw11 / Seam3

Cloudkit based persistent store for Core Data
Other
209 stars 25 forks source link

Bugfix: Support for large fetch requests #132

Closed fhasse95 closed 3 years ago

fhasse95 commented 3 years ago

If a user already has more than 400 items stored in iCloud and initiates an initial sync (for example, to get all the data from iCloud on a new device), the following operation error message occurs within the SMStoreSyncOperation class (line 465) (CKErrorDomain code 27: "Your request contains 400+ items which is more than the maximum number of items in a single request (400)"). As a result, no data is transferred from iCloud to the user's local database.

In order to fix this problem, I split the recordID array into smaller ones, each containing a maximum number of 400 elements. This will then add multiple CKFetchRecordsOperations to the operationQueue, which fixes the error.

fhasse95 commented 3 years ago

Hi, thanks for your feedback! :) I have taken your comments into account and adjusted the code accordingly. In addition, I noticed that the error message also occurs when adding or deleting more than 400 elements. For this reason, I have also made some additional changes to fix this.