I am new to ios programming,i created a class books which takes some values dynamically,so i am trying to set value for some params in book object,i am getting exception.
code:
Book
{
@property (strong,nonatomic) NSString *bookId;
@property (strong,nonatomic) NSString *bookStatus;
@property (strong,nonatomic) NSString *bookName;
}
Book * book =[Book alloc]init];
[book setValue:@"textbook" forKey:@"bookName"]; //not working
book.bookStatus=@"textbook" //not working
[book setbookStatus:@"textbook"]; //not working
}
I am getting exception [_NSCFDictionary setbookStatus] unrecognized selector
Book
class defined? What is the@interface code
? The exception shows that you tried to callsetBookStatus
on an instance ofNSDictionary
. You can just saybook.bookName=@"textbook";
– Paulw11 Apr 16 '16 at 6:36