6

My current method of deleting all of a certain kind of object in Core Data is to iterate over each object and delete manually, which is rather expensive.

Using the new batch updates added to Core Data this year, can it be accomplished like that?

Community
  • 1
  • 1
Doug Smith
  • 29,668
  • 57
  • 204
  • 388

2 Answers2

5

Unfortunately it's not possible at this time in OS X 10.10/iOS 8.

An NSBatchUpdateRequestis only limited to update selected properties. More information on this can be found in this blog post (see the "Deleting a lot of Objects: Not a Problem" section).

flashfabrixx
  • 1,183
  • 9
  • 22
5

Finally you can, in the new WWDC apple introduced NSBatchDeleteRequest(wwdc 2015)

Serluca
  • 2,102
  • 2
  • 19
  • 31