This is an issue that will affect many apps, and can be found in Xcode 8 beta (8S128d). This is the first beta, although it is not labelled beta 1.
The issue is with NSUserDefaults; it doesn't work. Here's the code, maybe put it in application:didFinishLaunchingWithOptions:
.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:@"hello world" forKey:@"TEST"];
[defaults synchronize];
NSString * oops = [[NSUserDefaults standardUserDefaults] valueForKey:@"TEST"];
NSLog(@"default = %@", oops);
In XCode 7 and earlier, this code works as expected: the value of oops
is "hello world".
In XCode 8, the value of oops
is nil
.
That's pretty major!
Found the answer: https://forums.developer.apple.com/message/143155#143155
If you've used XCode 7 or earlier, you need to reboot the Mac before running the iOS 10 simulator.