I want to get variable value from an objective-c class, using reflection.
company.h looks like
@interface Company : NSObject {
}
@property (nonatomic, retain) NSString* phone;
- (NSString*) getPropertyValueByName: (NSString*) paramName;
company.m looks like
@implementation Company
@synthesize phone;
- (NSString*) getPropertyValueByName: (NSString*) paramName
{
id me = self;
value = [me objectForKey: paramName];
return value;
}
@end
I am using this like:
Company* comp = [Company new];
comp.phone = @"+30123456";
NSString* phone = comp.getPropertyValueByName(@"phone");
What I am getting is an exception:
-[Company objectForKey:]: unrecognized selector sent to instance