简体   繁体   中英

how to store NSDictionary in NSUserdefaults and how can I retrieve from it

I am getting some info from web server like this.

970,
Aditya2,
B,
JNTU1,
"Ram@gamil.com"

I need to store these values and I need to retrieve it from there where I want.

I found NSDictionary is correct for this.

I need to save these values in NSDictionary.

How can I do this?

To store and then receive:

[[NSUserDefaults standardUserDefaults] setObject:myDictionary forKey:@"dictionaryKey"];
//...
NSDictionary * myDictionary = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"dictionaryKey"];

Here's a link to the NSUserDefaults Class Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM