[NSUserDefaults standardUserDefaults] objectForKey有时取出来的数据是nil

EDIT Bug logged: 28287988

Response from apple DTS team:

First off, you should first determine whether standardUserDefaults or valueForKey is failing. My guess is that “standardUserDefaults” is returning NULL and, if that’s the case, then that’s something you should be guarding against generally. Notably, standardUserDefaults will return NULL if the preference file is encrypted in the environment the app is currently running in (for example, preferences is set to “NSFileProtectionComplete” and the app is running in the background). That shouldn’t be an issue for standard foreground-only apps, but it’s something to be aware of anyway.

https://stackoverflow.com/questions/39457564/ios-10-with-xcode-8-gm-caused-nsuserdefaults-to-intermittently-not-work

猜你喜欢

转载自www.cnblogs.com/dengchaojie/p/9052341.html