I was wondering if there are any limits on the length of strings stored using Core Data in iOS. (other than available RAM or disk space on the device)
I think you're more likely to hit the performance limits on an iOS device before you hit any storage limits in Core Data. You'll also be getting a performance hit from pulling in large chunks of data.
You are better off, both in performance and manageability, breaking up large blocks of text into smaller chunks.
From what I remember Marcus Zarra telling me anyway.
Just to confirm, that there are no specific limits in CoreData (not counting memory/disk space limitations). When using CoreData on iOS you are in almost every case using sqlite as persistent storage. CoreData stores String as Varchar and from sqlite's point of view:
SQLite does not enforce the length of a VARCHAR. You can declare a VARCHAR(10) and SQLite will be happy to store a 500-million character string there. And it will keep all 500-million characters intact. Your content is never truncated. SQLite understands the column type of "VARCHAR(N)" to be the same as "TEXT", regardless of the value of N.
...taken from sqlite's FAQ
It does not have a limit as far as I can tell, unless you assign one in the model file (there is a section for min length and max length).
I don't remember reading any limits in Core Data documentations, but remember that Core Data is just a framework on top of a real database, usually sqlite. I think it's safe to assume that the limits are dictated by the underlying DB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With