Does NSUserDefaults save objects if the applicatio

2019-06-06 23:41发布

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条回答
劫难
2楼-- · 2019-06-07 00:12

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

查看更多
登录 后发表回答