I am looking for a way to store data about a user in iOS 4 that is similar to SharedPreferences in Android. Android's SharedPreferences basically stores key value pairs for an application and only that application can access it. http://developer.android.com/reference/android/content/SharedPreferences.html
Does iOS 4 have something built in that can accomplish what SharedPreferences does in Android?
NSUserDefaults
is your choice.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html
Typically you'd like to:
[NSUserDefaults standardUserDefaults]
)-set*:ForKey:
(* being int, double, bool, dictionary, object...)-*ForKey:
-synchronize
when neededIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With