KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using Core Data programmatically (i.e. not using .xcdatamodel data model files) in much the same manner as depicted in Apple's Core Data Utility Tutorial . So my problem is that when I try to add an attribute to an entity with the type NSBooleanAttributeType , it gets a bit buggy. When I add it to my NSManagedObject subclass header file (in the tutorial, that would be Run.h ) as @property (retain) BOOL *booleanProperty; compiling fails, saying error: property 'booleanProperty' with 'retain' attribute must be of object type . It seems like some places in Cocoa use NSNumber objects to represent booleans, so I tried setting it to @property (retain) NSNumber *booleanProperty; instead. However, this evokes the following runtime errors: *** -[NSAttributeDescription _setManagedObjectModel:]: unrecognized selector sent to instance 0x101b470 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSAttributeDescription _setManagedObjectModel:]: unrecognized selector sent to instance 0x101b470' Using GDB, I am able to trace this back to the line in my source code where I add my entity to the managed object model: [DVManagedObjectModel setEntities:[NSArray arrayWithObjects:myEntityWithABooleanAttribute, myOtherEntity]]; So my question is this: what type should I set booleanProperty to in my custom class header?
Tags (comma-separated)
Save Edits
Cancel