开发者

NSMutableDictonary of NSString getting null value

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜