键我愿做这样的事情:使用“生成的字符串”(stringWithFormat)作为NSDictionary的
#define GETKEY (a) ([NSString stringWithFormat:@"%d",a])
NSMutableDictionary *mutableDictionay=[NSMutableDictionary dictionary];
//population of dictionary
[mutableDictionary setObject:anObject forKey:GETKEY(someIntValue)];
//... then retrive the object
[mutableDictionary getObjectForKey:GETKEY(someIntValue)];
但我担心的stringWithFormat方法返回的NSString的不同实例具有相同值,我的意思是喜欢有2个字符串:“0”和另一个值为“0”的实例。我想知道这个是一种安全的方式来获取和设置字典中的对象。如果没有,什么其他方式可能是从一个整数“生成”一个关键对象的最佳方式?