views:

47

answers:

1

I want to load a UIView, first time my app loads. But I can't make it happen.

Here's my applicationdidFinishLaunching method:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    if(![[NSUserDefaults standardUserDefaults] boolForKey:@"AlreadyRan"] ) {
        [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:@"AlreadyRan"];
        // proceed to do what you wish to only on the first launch
        NarrativeView *narView = [[NarrativeView alloc] initWithNibName:@"NarrativeView" bundle:nil];
        [window addSubview:narView.view];
        [window makeKeyAndVisible];
        [narView release];      
    } else 
    {
        // Override point for customization after application launch.
        [window addSubview:rootController.view];
        [window makeKeyAndVisible];
    }
    return YES;
}

Can some one help me here?

+1  A: 

A possibility is that you never synchronize the NSUserDefaults. You need to add a [[NSUserDefaults standardUserDefaults] synchronize] call, either right there, or in applicationWillTerminate and/or applicationDidEnterBackground.

Daniel Dickison