Saving NSArray to NSUserDefaults and getting it in NSMutableArray

 [[NSUserDefaults standardUserDefaults] setObject:yourMutableArray forKey:@"Key"];

A mutable array can be stored since it is a subclass of NSArray.

To get the value as an NSMutableArray:

NSMutableArray *array = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"Key"]];

or

NSMutableArray *array = [[[NSUserDefaults standardUserDefaults] objectForKey:@"Key"] mutableCopy];

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)