views:

44

answers:

2

Hello,

I just started playing with Core Data.

I created an entity called Task with a property called Description. I opened Interface Builder and I added Core Data Entity view.

Picked my entity, property and tried to build the application. After clicking on "Add" button it crashed with EXC_BAD_ACCESS.

After I've renamed this attribute to 'desc' it works fine.

Can anyone explain me why is this happening? Is 'description' some kind of reserved word in Core Data or something?

+9  A: 

description is ann Objective-C property used for debugging and goes all the way down to Core Foundation, which has a corresponding CFDescription function. You should just name that property something else.

lucius
More Cocoa than Objective-C, but yeah.
Peter Hosey
It's method of NSObject. All classes that inherit from NSObject (which is virtually all) inherit the method. It produces a textual description of the object for debugging purposes. When you log an object with `NSLog(@"%@",anObject)` it calls the description method.
TechZen
I wrote Cocoa at first then edited it to Objective-C so I should have left it as it was.
lucius
As an additional comment to the OP, the compiler ***warns*** you that this is a reserved word. Never ever ignore warnings in Objective-C.
Marcus S. Zarra
I missed the warning :-(. Is there a list of reserved words that I can't use as property names?
Vojto
+4  A: 

It's a method with a particular purpose in Cocoa, and Core Data dislikes it being overridden. More here.

warrenm
+1 for the doc link
JeremyP