If I set an NSUserDefault
object and try to access it before it has been synchronized, will I be able to access the object I just added?
The purpose of [NSUserDefault synchronize];
is to make the user defaults get written on disk immediately.
Regarding this:
I'm unsure of if the synchronization is happening without me knowing it.
You don't need to call [NSUserDefault synchronize]
explicitly to store the value, iOS already does it at appropriate time (like when going into background).
So you can avoid that line unless you want to store that value immediately.
In fact, it's a performance problem if you call synchronize every time you set a value.