NSMutableDictionary memory / address problem, release does not work?
- by phil
I am trying to create a NSMutableDictionary(dictA) with objectA. When I try to view my dictionary(NSLog), each key is pointing to the same address. I have an objectA_1 which is type objectA and used to setup the dictionary. Also, if I try to getObject, I always get the last key/value that was added to the dictionary. I tried setValue and got the same results. Is there something wrong with my objectA? Is the release method not working properly? Am I retaining when I shouldn't? Thank you.
dictA = [[NSMutableDictionary alloc] init];
objectA *objectA = [[objectA alloc] init];
[dictA setObject:objectA_1 forKey:@"apple"];
[objectA_1 release];
[dictA setObject:objectA_1 forKey:@"japan"];
[objectA_1 release];
[dictA setObject:objectA_1 forKey:@"paris"];
[objectA_1 release];
[dictA setObject:objectA_1 forKey:@"pizza"];
[objectA_1 release];
//NSlog:
apple = "";
japan = "";
paris = "";
pizza = "";