Question: I've got some settings saved in my Settings.bundle, and I try to use them in `application:didFinishLaunchingWithOptions`, but on a first run on the simulator accessing objects by key always returns `nil` (or 0 in the case of ints). Once I go to the settings screen and then exit, they work fine for every run thereafter.

What's going on? Isn't the point of using default values in the Settings.bundle to be able to use them without requiring the user to enter them first?

Answer: 
If I got your question right, in your app delegate's - (void)applicationDidFinishLaunching:(UIApplication \*)application, set the default values for your settings by calling
registerDefaults:dictionaryWithYourDefaultValues
on [NSUserDefaults standardUserDefaults]

```
- (void)applicationDidFinishLaunching:(UIApplication *)application {    
    NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                          [NSNumber numberWithInt:3], @"SomeSettingKey",
                          @"Some string value", @"SomeOtherSettingKey",
                          nil];
    [ud registerDefaults:dict];
}

```

These values will only by used if those settings haven't been set or changed by previous executions of your application.
As coneybeare said "You should detect if it is the first load, then store all your defaults initially." 

On applicationDidFinishLaunching try to set default value in your preference.

Here is the sample:

```
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
if([defaults objectForKey:@"YOUR_KEY"] == nil)
{
    [defaults setValue:@"KEY_VALUE" forKey:@"YOUR_KEY"];
}

```

When application will run second time it will come with KEY\_VALUE for YOUR\_KEY.

Thanks,

Jim.