[NSUserDefaults synchronize] is Planned to be Deprecated

Our teammates found there is an issue with NSUserDefaults on iOS 10 SDK, and sometime app will unable to read previously saved data from NSUserDefaults.

Here are some references listed from his mail:

And then our teammate found synchronize is planned to deprecated. According to the header docs:

-synchronize is deprecated and will be marked with the NS_DEPRECATED macro in a future release.

-synchronize blocks the calling thread until all in-progress set operations have completed. This is no longer necessary. Replacements for previous uses of -synchronize depend on what the intent of calling synchronize was. If you synchronized…
— …before reading in order to fetch updated values: remove the synchronize call
— …after writing in order to notify another program to read: the other program can use KVO to observe the default without needing to notify
— …before exiting in a non-app (command line tool, agent, or daemon) process: call CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication)
— …for any other reason: remove the synchronize call

Interestingly that latest SDK header’s comment advise against explicit [NSUserDefaults synchronize]