I had a problem in my project where I declared the NSMutableDictionary property in the header file as follows:
@property (copy, nonatomic) NSMutableDictionary *DataDict ;
Now, in the implementation file, I continue and initialize this dictionary, because I will use it, for example:
DataDict = [[NSMutableDictionary alloc]init];
Now that I have done this, the minute I try to add something to this dictionary, I would get an error message:
- [__ NSDictionaryI setObject: forKey:]: unrecognized selector sent to instance 0x885ae60 2012-10-19 16: 51: 56.040 testing [2297: c07] * Application terminated due to an uncaught exception 'NSInvalidArgumentException', reason: '- [__ NSDictionaryI setObject: forKey:]: unrecognized selector sent to instance 0x885ae60 '
After some time and through my project a thousand times, I decided to uncomment my initialization line, for example:
and this fixed the problem.
My question is why?
source share