简体   繁体   中英

Can NSUserDefaults store multiple different data types?

Such as both a boolean and an integer? Thanks for your help!

Yes. NSUserDefaults simply operates like an NSDictionary, but with a few more convenience methods .

Don't forget to synchronize the data you set after you're done.

Sure! Here are the setter functions for NSUserDefaults :

– setBool:forKey:
– setFloat:forKey:
– setInteger:forKey:
– setObject:forKey:
– setDouble:forKey:
– setURL:forKey:

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