You can think of attributes as the columns of a table in a database. Attributes store the values of a Core Data record. There are several types of attributes, such as String, Date, Integer, Float, and Boolean. Select the Note entity in the data model editor and click the + button at the bottom of the Attributes table.
Core Data supports entity attributes of 'Transformable' type. Transformable type allows us to store custom data types as an object of the declared attribute for a record of an Entity. The only requirement is that our custom type should conform to NSCoding or we need to provide a custom value transformer.
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.
An entity describes an object, including its name, attributes, and relationships. Create an entity for each of your app's objects.
I have a simple Core Data entity that had a string attribute named "description". The program crashes when it hits:
valueForKey:@"description"
I changed the "description" attribute to "text" and problem solved.
Why does this happen?
Is "description" a reserved key word in Core Data?
Is it related to calling the description method from NSObject?
Is there a reference to these reserved key words if they exist?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With