Take the 2-minute tour ×

For example:

NSUserDefaults *user = [NSUserDefaults standardUserDefaults];   
[user setObject:textField1.text forKey:@"receive_text1"];
[user setObject:textField2.text forKey:@"receive_text2"];
[user synchronize];

If I leave this app, just like from background to foreground, or relaunching the app

Could objects in NSUserDefaults still get the data that I set before?

share|improve this question
I am sorry, I am the downvoter, but it was an accidental click and now I can't reverse it. Can someone please upvote to compensate? –  Nick Moore Jan 4 '11 at 20:30
If you click the down arrow again, it should remove your downvote. Its like a toggle button. –  Jasarien Jan 5 '11 at 9:54

1 Answer 1

up vote 6 down vote accepted

NSUserDefault is persistent. So the data will be saved until you remove them or delete the app from the device.

share|improve this answer
thank you ,vote your answer too –  miniHsieh Jan 4 '11 at 10:43

Your Answer


