0

I am using Core Data in my app,

and maybe my users wants to delete all the NSManagedObjects that they once saved,

So is there a quick method of NSManagedObjectContext that can do this, I mean, clear the whole persistent store, or in another word,delete all objects of every entity, so there's no actual objects (except entities) in core data?

Thanks a lot!

braX
  • 11,506
  • 5
  • 20
  • 33
Wang Liang
  • 941
  • 2
  • 15
  • 34
  • possible duplicate of [Delete/Reset all entries in Core Data?](http://stackoverflow.com/questions/1077810/delete-reset-all-entries-in-core-data) – lxt Feb 19 '12 at 16:52

2 Answers2

0

Just delete the file and recreate your persistent store, then everything is nice and empty.

JustSid
  • 25,168
  • 7
  • 79
  • 97
0

You can either delete everything entity-by-entity or clear the store file itself.

See this solution: Delete/Reset all entries in Core Data?

Community
  • 1
  • 1
coverback
  • 4,413
  • 1
  • 19
  • 31