Is Core Data / NSAtomicStore only for data objects with IDs?
Is Core Data / NSAtomicStore only for data objects with IDs?
- Subject: Is Core Data / NSAtomicStore only for data objects with IDs?
- From: Daryle Walker <email@hidden>
- Date: Mon, 29 Feb 2016 21:00:16 -0500
OK, I’m about to write a cool app. I’m thinking of using Core Data to handle the, well, data. I’ve been looking around for weeks on how to use NSAtomicStore to read/write data in “legacy formats.” I finally saw a guide by Apple today (referenced from the API page for NSAtomicStore). The classes assume you’ll be generating some ID data for your various nodes. My data is dumb; it has no database-ish IDs anywhere to use. I can’t just make up random UUIDs because the lookups have to be reversible and the format is too dumb to place any IDs. Does this mean that my quest has been for nothing, that I can’t use CoreData to directly serialize to/from my format?
I just said “directly” because I can still make a data model for my format. I just have to strip out any IDs when I serialize it to users. I can keep any internal IDs when I store object graphs in my app’s library folders. Of course, I can’t directly read in the format either; I have to read the data in separately, create a blank object graph, import the data in, and keep track of both the graph and original file’s URL when I need to save out (I’ll just export the graph to a new ID-less file and swap.).
The guide mentioned HTML and CSV examples, but didn’t show any. HTML I can understand; you can use something like DOM to address every node. I can’t see it with CSV, unless you use one of the fields to make an ID. Is that what Apple meant, or can you use Core Data with dumb, un-ID’d data?
(I can understand the “use NSIncrementalStore for Internet-based stores” claims too. The main database’s URL serves as the store’s ID, and the inner objects and attributes can be represented by sub-URLs and/or index paths.)
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden