To delete all instances of a given entity (we'll use your ShoppingBasket), you can simply fetch all baskets then delete them. It's just a few lines of code: NSManagedObjectContext * context = self managedObjectContext; NSFetchRequest * fetch = NSFetchRequest alloc init autorelease; fetch setEntity:NSEntityDescription entityForName:@"ShoppingBasket" inManagedObjectContext:context; NSArray * result = context executeFetchRequest:fetch error:nil; for (id basket in result) context deleteObject:basket The alternative in a non-document-based app is to shut down your connection to the data store, delete the actual file, then reconnect (the template code that comes with a standard Core Data project will automatically create the file if it's absent). You then have a brand new, empty store Note, the code example ignores any possible error.
Don't do that. :-).
To delete all instances of a given entity (we'll use your ShoppingBasket), you can simply fetch all baskets then delete them. It's just a few lines of code: NSManagedObjectContext * context = self managedObjectContext; NSFetchRequest * fetch = NSFetchRequest alloc init autorelease; fetch setEntity:NSEntityDescription entityForName:@"ShoppingBasket" inManagedObjectContext:context; NSArray * result = context executeFetchRequest:fetch error:nil; for (id basket in result) context deleteObject:basket; The alternative in a non-document-based app is to shut down your connection to the data store, delete the actual file, then reconnect (the template code that comes with a standard Core Data project will automatically create the file if it's absent). You then have a brand new, empty store.
Note, the code example ignores any possible error. Don't do that. :-).
I.e. Flush Context, or empty context, or deleteAll – Patrick May 11 at 12:33 Nope.No convenient "DROP DATABASE;" stand-in. – Joshua Nozzi May 11 at 13:16.
A much quicker way would be to just remove store entirely. This way you're not wasting any time fetching objects, or enumerating through them as the other answer does. NSError *error NSURL *applicationDocumentsDirectory = NSFileManager defaultManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask lastObject; NSURL *storeURL = applicationDocumentsDirectory URLByAppendingPathComponent:@"MyCDStore.
Sqlite"; NSFileManager defaultManager removeItemAtPath:storeURL. Path error:&error; Don't forget to re-create it after you have deleted it.
To delete all instances of a given entity (we'll use your ShoppingBasket), you can simply fetch all baskets then delete them. The alternative in a non-document-based app is to shut down your connection to the data store, delete the actual file, then reconnect (the template code that comes with a standard Core Data project will automatically create the file if it's absent). You then have a brand new, empty store.
Note, the code example ignores any possible error.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.