Concerns about changing NSManagedObjectContext
Concerns about changing NSManagedObjectContext
- Subject: Concerns about changing NSManagedObjectContext
- From: "Jim Thomason" <email@hidden>
- Date: Fri, 15 Jun 2007 17:37:44 -0500
Okay, so this was my bad for not creating my app as a document based app and
instead making it a regular coredata app. Little did I know my users would
start asking for multiple document support. My bad.
Anyway, as a stopgap, I'm thinking about adding in backup/restore
functionality. So the user can backup the store to a different location, and
restore from a backup. It's a bit clunky and only allows one "document" to
be open at a time, but it'll do.
But before I race down this path at too breakneck a pace, are there any
"gotchas" in doing this?
The backup step is braindead simple - just save any changes, and copy the
store to the location specified by the user. No concerns here.
The restore is a little more complicated. To do that, I...
1) discard changes in the current store and throw away the context and the
store coordinator.
2) Then I remove the existing store and
3) copy the specified store into place
4) Finally, I say that I fire off the notes changing the value for the
managedObjectContext and call the managedObjectContext method specified in
the CoreData template.
Easy as pie. But I still consider CoreData to be magical for all intents and
purposes, so I don't know if I'm setting myself up for trouble by doing
this. Anybody know if this is gonna be problematic?
Also, are there any general techniques for migrating a coredata app to a
document based one? I'm thinking I basically just need to move my delegate
methods into a persistent document, and my most of my main menu into the doc
nib, but if there are general things to take into account, that'd be great
to know.
-Jim....
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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