NSMutableDictionary, alloc, init and reiniting...

Posted by Marcos Issler on Stack Overflow See other posts from Stack Overflow or by Marcos Issler
Published on 2010-03-17T03:05:13Z Indexed on 2010/03/17 3:11 UTC
Read the original article Hit count: 513

In the following code:

//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]];
} 

Why this crash? How is the right way to clear an nsmutabledict and the assign a new dict?

Thanks guy's.

Marcos.

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about nsmutabledictionary