Re: CoreData, reset a persistent store
Re: CoreData, reset a persistent store
- Subject: Re: CoreData, reset a persistent store
- From: Elise van Looij <email@hidden>
- Date: Tue, 14 Nov 2006 15:29:11 +0100
Op 14-nov-2006, om 14:43 heeft Pierre Chatelier het volgende geschreven:
Hello,
I am wondering how to reset a persistent store used by a single
data model.
-A simple solution would be to fetch all objects and delete them;
this consumes much memory.
-I am not sure that deleting the file under the persistent store is
a good idea.
-the "reset" method of the managed object model is not designed for
that.
Did I miss something ?
If I understand you correctly, yes. In Xcode, simply change the url
in your appDelegate's (or controllers) .m file:
url = [NSURL fileURLWithPath: [applicationSupportFolder
stringByAppendingPathComponent: @"someProject.xml"]];
( see http://www.cocoadevcentral.com/articles/000085.php on how to
set the correct type).
The build and run will take a bit longer the first time, but that's
all. The store itself you'll find under the theUser/Library/
Application Support/SomeProject/
The NSPersistentStoreCoordinator is designed not to care which store
you use, as long as it confirms to the expecations of the
ManagedObjectContext which in turn looked to the data model for
guidance.
Elise van Looij
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden