UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Deleting records from CloudKit and it's limitation.

Forums > SwiftUI

Hi All,

I would love to get you help and opinion on a problem I'm currently facing.

I have the need to delete over 400 records from CloudKit when the user chooses to delete their reminders, I have a solution in place currently that splits the array of records to delete into batches of 399 so to avoid the CloudKit limit of 400, however it is painfully slow and to a point I'm worried that in the time it takes to complete the operation the user may well have left and closed the app leaving a mess of non-deleted reminders in CloudKit but not on the app itself.

My question is this, Apple clearly state the limit as being 400 and say the following on their documentation:

To ensure the speed of fetching and saving records, the server may reject large operations. When this occurs, a block reports the CKError.Code.limitExceeded error. Your app should handle this error, and refactor the operation into multiple smaller batches.

I was wondering if there is a much more efficient way of deleting records using a cursor approach like there is for receiving records in and if so how would I implement this as there is no real mention of something like this on any of the forums I've been looking through. If not, how can I increase the speed and reliability of deletions so that it is as instantaneous as retrieving records.

Thank you anyone for your help, it is much appreciated.

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.