PhotoWheel icon indicating copy to clipboard operation
PhotoWheel copied to clipboard

Stored images in document store are not included in delete methods

Open cjazz opened this issue 12 years ago • 3 comments

I am currently looking into ways to remedy this.

cjazz avatar Dec 01 '12 03:12 cjazz

Here's what you would need to do to delete external image files, which were added in chapter 23:

  • Add a prepareForDeletion method in Photo.m. This gets called automatically any time a managed object is going to be deleted.
  • In this method, look up the file URL for each of the image files
  • Use NSFileManager to delete the image files.

atomicbird avatar Dec 04 '12 00:12 atomicbird

Thanks Tom! I'll try that out and let you know the results. ~ Adam

cjazz avatar Dec 04 '12 01:12 cjazz

Tom, this is confirmed to work like a charm! - (void)prepareForDeletion in Photo.m. My code is rather crude and in a unit test form, but if anyone is interested in getting it, let me know, and perhaps by that time it'll be more efficient. Cheers, and Happy Holidays!

cjazz avatar Dec 04 '12 04:12 cjazz