I'm using Xcode 6.1.1 and the iOS SDK 8.1
I have a class that is derived from NSObject
, but its property is defined in a protocol (it is called phoneNumber
, which I don't believe to be a problematic name). I'm getting the error message
this class is not key value coding-compliant for the key phoneNumber.
so I implemented the valueForKey:
and setValue:ForKey:
methods on my own and it fixed it. Is there a better way of doing making it KVC compliant?
Auto property synthesis will not synthesize properties declared in protocols, you need synthesize it.(or create the getter and setter by hand).
In the class that implements the protocol add this line in the implementation file.
@synthesize phoneNumber = _phoneNumber;