I’m having a similar problem. I found a reddit post about this issue where the author writes,
“I’m guessing it only shows up for devs who bulk import/delete during testing, while normal users with a few hundred records never notice.”
Which makes sense because I am also bulk importing. I’m seeing about a 6-8 times increase between the local storage and CloudKit. (Specifically, 15k records comes out to around 13mb of local storage, but 100mb with CloudKit enabled. ANSCKRECORDMETADATA appears to be the main culprit.)
I’m making a flashcard app, and of course users can import as many cards as they want, which could become a storage problem pretty quickly. From my understanding, and as you mentioned, a storage increase is expected. But the increase I’m seeing just seems excessive. … Or is it? I can’t really find anything on what to expect.
I wonder if there’s something I can change in the model to make this work. Or maybe the problem is unique to NSPersistentCloudKitContainer and I should look at other sync options, but your second experiment seems to discount that.
The poster I mentioned earlier talked about trying to clear the CloudKit metadata tables using NSPersistentHistoryChangeRequest.deleteHistory(before:), but was unable to do so due to using SwiftData (like I am).
I’m a bit of an amateur and I’m pretty out of my depth, so I’d rather stick to NSPersistentCloudKitContainer if possible. In every other respect, syncing with SwiftData has been easy and is working perfectly—it’s just the storage size I’m worried about.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: