Search code examples
iosobjective-ccore-datauiimagensdata

How would I be best off storing images to be used as a UIImage in a Core Data store? Transformable? Binary data?


There seems to be conflicting answers on this question and I'm confused what the best way to store images in a Core Data database is.

This question says transformable, however this question says to use Binary Data.

If I just want to take it and turn it into a UIImage/UIImageView what would I be better off using?


Solution

  • I generally store images outside of Core Data (in the documents directory, or in the bundle) and then save paths to them in Core Data.

    The other approach I've seen recommended is to save your images as BLOBs, but in a separate entity so you don't bog down your other entities with all that data.