More Core Data Questions
More Core Data Questions
- Subject: More Core Data Questions
- From: Jon Hull <email@hidden>
- Date: Mon, 12 Oct 2009 12:31:30 -0700
Ok, let me ask some more specific questions and see if that gets a
response... Feel free to respond if you only know the answer to 1 or
2 of these.
1) Can I count on a to-many relationship keeping the order of the
managedObjects it points to? The order is very important in this
case, and I need a way to ensure that the order does not change when
the object is saved and reloaded.
2) Does core data require a run-loop to work? All of the work takes
place in a background thread, and that is the only thread which would
be accessing these objects (the main thread doesn't see them, it
passes arrays of NSStrings or NSNumbers to the main thread and blocks
until it receives a response string/number), but there is no run loop
on the background thread. It just executes and then goes away once it
is done. The reason I want core data is that there are several
thousand objects to be processed in this thread, and I only want to
keep the ones in memory that need to be in memory at any given
moment. Also, different objects may be accessed depending on the
value of previous objects or the responses mentioned above.
3) What is the best way of connecting objects from different stores?
I am considering giving them UUIDs and then storing that as a
reference. Then setting a transient property based on that in -
awakeFromFetch. Alternatively, I could store it as a fetched
property, but I want it to be a 1:1 correspondence.
4) Is there a better way to get this lazy loading? My main goal is to
keep only those objects from this large (>1000) object graph in memory
that are needed (since the iPhone has limited memory). Basically, I
want the behavior of the old resource manager from the olden days
(that is I can act as if my full object graph is in memory, but only
those that are needed actually are... and they are fetched just in
time). My options seem to be the following:
• Use core data in a rather complex way
• Roll my own SQL with a single table that stores blobs by that
identifier (see above) and then returns a freeze dried object from the
blob.
• Store each object as a small file in a folder and use the
identifier in the filename
• Something with proxies that go grab it just in time (combined with
SQL or the files above)
• Something I haven't thought of...
Any help is greatly appreciated!
Thanks,
Jon_______________________________________________
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