views:

36

answers:

1

I saved an array using the following code:

NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myArray];
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"myArray"];

What is the code to load it back into memory?

A: 

Put this where you need to load it, should work. You'll get back an immutable NSData object.

NSData *data = [[NSUserDefaults standardUserDefaults] dataForKey:@"myArray"];
Hector204