Daniel
Daniel

Reputation: 1037

Storing images using CoreData but without using NSData

I use CoreData for storing images. Often these images are the same. I use bindings to setup a table view. One column contains the images.

Now I don't always want to store the whole image data. I just want to store the path to the image, but still display the images in the table view.

What's the best way to do so? I can' figure it out.

Upvotes: 0

Views: 274

Answers (1)

Peter DeWeese
Peter DeWeese

Reputation: 18333

You can store a string and required metadata for each one. If you are worried about name conflicts, rename the files as unique identifiers and store the file's real name or title in the database in a second column. The biggest risk is the file system going out of sync with the database representation, so be careful to check for errors and to handle them appropriately, for example, if the image row can't be deleted, you shouldn't delete the file and vice versa.

Upvotes: 1

Related Questions