Skip to content

Instantly share code, notes, and snippets.

@soffes
Created July 2, 2010 15:11
Show Gist options
  • Save soffes/461479 to your computer and use it in GitHub Desktop.
Save soffes/461479 to your computer and use it in GitHub Desktop.
// Given `notes` contains an array of Note objects
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:notes];
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"notes"];
NSData *notesData = [[NSUserDefaults standardUserDefaults] objectForKey:@"notes"];
NSArray *notes = [NSKeyedUnarchiver unarchiveObjectWithData:notesData];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment