Saving for iPhone - Can core data handle this?
Saving for iPhone - Can core data handle this?
- Subject: Saving for iPhone - Can core data handle this?
- From: Ben Trumbull <email@hidden>
- Date: Mon, 12 Oct 2009 13:00:03 -0700
Jon,
Your question is a bit amorphous. Can Core Data do something like
this ? Sure. May it require adjusting things to fit into its
architecture ? Possibly.
I have a game project for the iPhone which has a rather complicated
object graph
Well, it would probably only take a few minutes to mock something up
in the model editor in Xcode. That would help make your question more
concrete.
There is a large graph of tiny immutable objects which represent the
story (including different branches of the storyline).
How tiny is tiny ? People have widely different ideas about "tiny"
and "huge" and the difficulties of various problems.
This graph is
large enough that I only want to keep the nodes that are actually
being used in memory.
100 objects ? 1,000 ? 100,000,000 ? The largest db in a deployed
iPhone app using Core Data that I know of is about 450,000 rows. (FDA
warning: results not typical)
There is also a separate graph of game objects
(characters, etc...) that change state over time and will need to be
saved as part of a saved game. These seem like they should be stored
separately since one never changes and will be common for all players,
while the other is different for each player. I also want to be able
to get a fresh copy of the changing objects for new games.
Is this for local or remote data ?
The final complication is that I have several proxies being used in an
important way, and I don't think there is any NSProxy equivalent for
NSManagedObject. I guess I would just have to hope that
NSManagedObject doesn't have any methods that the targets of the proxy
override.
Uhm... Why ? I don't think NSManagedObject will be happy with
NSProxy and vice versa. I'd recommend against this. If you need to
use NSProxy for something else, then I'd recommend adding an observer
to the NSManagedObjectContext and proxying your custom observer. Or,
you can use composition to create your own object that has an
NSManagedObject || NSManagedObjectID ivar and then proxy that.
I have been reading the docs for Core Data, and have a rough idea on
how I might accomplish all of this, but I wanted to see if someone had
experience with this and could keep me from spending time going down
the wrong path if it isn't going to work.
So, do you think core data can handle this? What approach (roughly)
should I use?
- 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