Reputation: 171
I'm trying to override -(NSString *)description in a class defined with ONLY @dynamic properties.
So my class looks like this... (excerpt)...
@implementation SomeClass
@dynamic somePropertyOne;
@dynamic somePropertyTwo;
@dynamic somePropertyThree;
-(NSString *)description
{
return (NSString stringWithFormat:@"somePropertyOne = %@",somePropertyOne)
}
@end
and I'm getting an error message saying "Can't resolve variable 'somePropertyOne'" in my description override. Is it not possible to refer to a @dynamic property like this? How can I override description to show this information?
Upvotes: 0
Views: 105
Reputation: 119031
You need to use self.somePropertyOne
.
A dynamic
property is just like a normal property in terms of definition. The difference is that @synthesize
(which is the actual counterpart, not the property definition) creates the accessor methods in the current class whereas @dynamic
indicates that a superclass implements the accessor methods.
Upvotes: 2