Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store image in core data

Tags:

core-data

I want to store image for every employee while updating their records. How can I do that?

I have a dictionary storing name, id and department of employees. Now i want the image to be saved together.

like image 288
Dipanjan Dutta Avatar asked Mar 03 '26 04:03

Dipanjan Dutta


1 Answers

Core Data supports the "Binary Data" type - When you define a model with a Binary Data field, it creates your model class with an NSData field. You can move an image into the NSData field, and CoreData will save it for you.

You can then use UIImage initWithData: to load the image from the NSData field.

Hope this helps !

like image 100
ferdil Avatar answered Mar 06 '26 01:03

ferdil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!