Code:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@\"A\"
For custom descriptions you are welcome to override -(NSString *)debugDescription
from NSObject Protocol.
From Apple's doc:
NSObject implements this method by calling through to the description method. Thus, by default, an object’s debug description is the same as its description. However, you can override debugDescription if you want to decouple these.
From Core Data Programming Guide
You are discouraged from overriding description—if this method fires a fault during a debugging operation, the results may be unpredictable—and initWithEntity:insertIntoManagedObjectContext:. You should typically not override the key-value coding methods such as valueForKey: and setValue:forKeyPath:.
-description
is a method in NSObject that returns a string representation of your object. In the line NSLog(@"%@", object)
, -description
is used to get the string that you see in the console. Key-value coding will end up using the method to get the property for the description attribute. This causes a whole lot of confusion to Core Data.
The programming guide is being generous when it says "discouraged". They really mean "Yeah, it's going to break your stuff."
That link also has a good list of other methods that will break your stuff if you override them.
you need to treat description as a reserved word. That is the issue you are having. You should have received a warning when you tried to have a property called description.