I'm creating a NSMutableDictonary:
dict = [[NSMutableDictionary alloc] init];
And after adding string items:
[dict setObject:@"three" forKey:@"apple"];
[dict setObject:@"factory" forKey:@"car"]开发者_StackOverflow社区;
[dict setObject:@"big bang" forKey:@"earth"];
I got the values if I try to access right after this. But if I try to access sometime after I got null value.
I belive it's because these strings is autoreleased. Then, the question is: What is the correct way to do this?
Really sorry guys! The example that I put here works, fine! The problem was the newbie debugging the code, me, making mistake about where is the problem. I was putting null value, believing that wasn't.
Thanks all.
精彩评论