I have an app written in Swift (iOS 8) that, on the first time it is opened, offers to take you to the settings in the main settings panel of iOS. It uses this code:
UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString)!)
This works fine, except that the settings panel is empty when you arrive. If you tap the Settings back button, then go right back into the settings for the app, all of the options appear.
I assume this is related to the same issue where nsuserdefaults don't appear to exist until the user actually visits the settings panel.
Anyway, does anyone have any idea how to get around this?
Notes:
1) This occurs only on the first launch of the app AFTER it is initially installed. Once the settings panel has been visited at least once, it works fine.
2) My app already checks for the existence of an initial default value; if missing, it initializes ALL settings, both for the current session, AND writes them to the settings bundle — I have verified that this part is working by flipping one of the defaults from true to false and noticing that it is false upon first view of the settings.
Not sure how you are setting your default values based on your description. You can try to set them this way.
To view the what is in the value before you set just add this line after var line. Then add it after the defaults.synchronize() to see what was set.
Also you could try setting them during the build process with a script.