Skip to content

Instantly share code, notes, and snippets.

@soedar
Last active December 18, 2015 16:29
Show Gist options
  • Save soedar/5811610 to your computer and use it in GitHub Desktop.
Save soedar/5811610 to your computer and use it in GitHub Desktop.
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
NSString *plistfile = [documentsDirectory stringByAppendingString:@"Global.plist"];
NSDictionary *dictionaryToSerialize = @{@"Hello": @"World", @"Dictionary": @{@"InnerHello": @"InnerWorld"}};
[dictionaryToSerialize writeToFile:plistfile atomically:YES];
NSDictionary *dictionaryToDeserialize = [NSDictionary dictionaryWithContentsOfFile:plistfile];
NSLog(@"%@", dictionaryToDeserialize[@"Dictionary"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment