If You want to save some details of user in device then you can use NSUserDefaults.
It just like SharedPreference or cookie.
To write data in NSUserDefaults use below code.
NSString *valueToSave = @"someValue";
[[NSUserDefaults standardUserDefaults] setObject:valueToSave forKey:@"myKey"];
[[NSUserDefaults standardUserDefaults] synchronize];
To read data from NSUserDefaults use below code.
NSString *savedValue = [[NSUserDefaults standardUserDefaults]
stringForKey:@"myKey"];
It just like SharedPreference or cookie.
To write data in NSUserDefaults use below code.
NSString *valueToSave = @"someValue";
[[NSUserDefaults standardUserDefaults] setObject:valueToSave forKey:@"myKey"];
[[NSUserDefaults standardUserDefaults] synchronize];
To read data from NSUserDefaults use below code.
NSString *savedValue = [[NSUserDefaults standardUserDefaults]
stringForKey:@"myKey"];
No comments:
Post a Comment