-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug:sometime store property failure #23
Comments
When using GVUserDefaults you also need to make sure to synchronize NSUserDefaults, or your changes might not be saved before you quit your app.
|
how to synchronize in project? |
[[NSUserDefaults standardUserDefaults] synchronize] |
How to save object? |
Hi. needs help.
I find sometime store property failure.
my category GVUserDefaults (YOSProperties) has property like this:
@Property (nonatomic, weak) NSString *currentLoginID;
when network request success. I save userId in success block:
[GVUserDefaults standardUserDefaults].currentLoginID = model.ID;
It work this time. I can get data from [GVUserDefaults standardUserDefaults].currentLoginID
But reopen my app. It doesn't work. [GVUserDefaults standardUserDefaults].currentLoginID return nil
I replace
[GVUserDefaults standardUserDefaults].currentLoginID = model.ID;
to
[GVUserDefaults standardUserDefaults].currentLoginID = model.ID;
[[NSUserDefaults standardUserDefaults] synchronize];
It works all the time.
thinks.
The text was updated successfully, but these errors were encountered: