I've got this code to read a preference. The output to the console is 1, but the window is not set to NSModalPanelWindowLevel. I have tried to use 1 instead of @"1" but that doesn't work either.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *alwaysonforeground = [defaults objectForKey:@"alwaysonforeground"]; if (alwaysonforeground == @"1") [window setLevel:NSModalPanelWindowLevel]; NSLog(alwaysonforeground);