Skip to content

Instantly share code, notes, and snippets.

@aaronpearce
Created May 30, 2013 04:56
Show Gist options
  • Save aaronpearce/5675804 to your computer and use it in GitHub Desktop.
Save aaronpearce/5675804 to your computer and use it in GitHub Desktop.
// loading
NSString *jsonString = [SSKeychain passwordForService:@"info" account:@"info"];
if(jsonString)
[array addEntriesFromDictionary:[NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:nil]];
// saving
NSString *jsonString = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
[SSKeychain setPassword:jsonString forService:@"info" account:@"info"];
----
Anything you can convert to a string you can save. In the above I saved an array into a JSON string which I stored.
give me an example of what you are saving and I'll make an example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment