在下面的代碼:的NSMutableDictionary,分配,init和reiniting
//anArray is a Array of Dictionary with 5 objs.
//here we init with the first
NSMutableDictionary *anMutableDict = [[NSMutableDictionary alloc] initWithDictionary:[anArray objectAtIndex:0]];
... use of anMutableDict ...
//then want to clear the MutableDict and assign the other dicts that was in the array of dicts
for (int i=1;i<5;i++) {
[anMutableDict removeAllObjects];
[anMutableDict initWithDictionary:[anArray objectAtIndex:i]];
}
爲什麼這會崩潰嗎?如何正確的方式來清除無效的字典並分配新的字典?
謝謝你的。
馬科斯。
好的!這是一個很好的解釋! – 2010-03-17 03:47:43
@Marcos:那麼你應該*接受* @查克的回答。這是履行你的問題的好方法。 – 2010-03-17 14:07:24