Reputation: 5617
I have a project with a class that extends NSObject:
interface ExtendedObject : NSObject<MKAnnotation>
@property NSString *name;
@property NSString *address;
@property NSString *description;
@end
When I later use this class and attempt to assign a value to the object's description
variable:
#import “ExtendedObject”
@implementation MyClass
-(void)viewDidLoad {
ExtendedObject *myObj = [ExtendedObject alloc];
myObj.description = @“SOME TEXT HERE”;
}
@end
I get an error:
-[ExtendedObject setDescription:]: unrecognized selector sent to instance
From what I have gathered, this is occurring because description
is the name of a method of NSObject
.
This was not causing a crash until I started testing on iOS 8.
Is my understanding correct and is there a way to use a variable named description
here?
Upvotes: 0
Views: 508
Reputation: 57050
There is already a read-only description
property in NSObject
. Use a different name.
Upvotes: 1