问题
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?
回答1:
NSUserDefault is persistent. So the data will be saved until you remove them or delete the app from the device.
来源:https://stackoverflow.com/questions/4592550/does-nsuserdefaults-save-objects-if-the-application-becomes-inactive