re: More Core Data Questions
re: More Core Data Questions
- Subject: re: More Core Data Questions
- From: Ben Trumbull <email@hidden>
- Date: Mon, 12 Oct 2009 14:08:01 -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.
No. You'll have to model order as an attribute yourself.
2) Does core data require a run-loop to work?
No.
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.
That's fine, although you can just use the URI representation of the
destination object instead of creating your own separate UUID. You
might look at /Developer/Examples/CoreData/iClass
4) Is there a better way to get this lazy loading?
What was the first way ?
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).
You may find the NSFetchedResultsController useful, as well as the
options on NSFetchRequest like -setFetchBatchSize: They are very
aggressive about memory optimizations.
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).
Core Data always does that. That's the default with its SQLite
persistent store.
Are you making this more complicated than it needs to be for
performance issues you have yet to measure ? I wouldn't add multiple
stores to work around a performance issue before actually trying it.
- Ben
_______________________________________________
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