I am encountering a strange issue in iOS 8.2 where [NSUserDefaults standardUserDefaults] is returning nil on iPhone. This same logic untouched has worked on all previous releases of iOS. I have a universal app which has two different settings.plist one for iPad and the other for iPhone list as follows;
Settings.bundle-
-Root.plist
-Root~iphone.plist
When installed on devices the correct settings pane displays and the user can input the appropriate values for the given fields. Though in my app at runtime [NSUserDefaults standardUserDefalts] returns a nil object.
What might I be doing wrong? Has Apple changed what is expected in 8.2?
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
userDefaults is always nil no matter what preferences are set in system settings.
Did you set the dictionary to use as
"Settings.bundle/Root.plist"
?Thereafter
[NSUserDefaults standardUserDefaults]
no longer is nil.In my case, the dictionary used by
[NSUserDefaults standardUserDefaults]
looks like this in the debugger:To access the preferences I've written a tiny method: