views:

85

answers:

1

i have a plist that's at its root an array with dictonaries inside it.

i load a plist from my recourses as an NSMutableArray.

[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Filters" ofType:@"plist"]]

i store it into nsuserdefault because it has to be persistent between startups.

[[NSUserDefaults standardUserDefaults] setObject:array forKey:@"filters"];

but i can't change the dictonaries in the array because they are not mutable. how can i make them mutable?

+1  A: 

You can replace the dictionary by a mutable copy of itself, using the 'mutableCopy' method of NSDictionary.

[EDIT] Example:

[ array replaceObjectAtIndex: 42 withObject: [ [ [ array objectAtIndex: 42 ] mutableCopy ] autorelease ] ];

Macmade
uhu, is it posible to it directly on the array without making a copy from it ?
Andy Jacobs