Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to store NSDictionary as transformable properties in core data

I have a NSDictionary in which I wanted to store in my core data model. How can I do this?

like image 893
adit Avatar asked Feb 27 '12 20:02

adit


People also ask

How do you use transformable Core Data?

To implement a Transformable attribute, configure it by setting its type to Transformable and specifying the transformer and custom class name in Data Model Inspector, then register a transformer with code before an app loads its Core Data stack.

How do I save in Core Data?

Right-click on your project's folder in the project navigator and then New File… In the new window, type “data” in the top right corner, select Data Model, and press Next. Give it a name, and save it. Now, let's add all the necessary code to connect Core Data with our project.


1 Answers

Set the attribute to Transformable and this serializes it to and from NSData automatically for you. No need to manually archive as in the other answer.

like image 161
malhal Avatar answered Sep 28 '22 08:09

malhal