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
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)