0

I develop an iPhone app and I want to show the user a welcome screen on the first load of the app after installation.
That means that the next time the user will use my app he will not see that screen.

Any ideas how to determine if this is the first load or not? (DB? File? Settings?)

Thanks!

1 Answer 1

3

I'd suggest writing a flag to NSUSerDefaults during the first run. Then you can check that flag during subsequent runs.

The "User Defaults Programming Guide for Cocoa" (included in the iPhone SDK documentation) is a good place to start.

The quick answer:

if(![[NSUserDefaults standardUserDefaults] boolForKey:@"NotFirstStart"])  
{  
    //show splash  
    [[NSUserDefaults standardUserDefaults]
        setObject:@"YES" forKey:@"NotFirstStart"];    
}
2
  • don't you want to set the object to @"NO" in the first Run block? your code looks to me like it would never hide the splash screen. Nov 27, 2009 at 7:21
  • Whoops, you are right. It's probably best to change the key name too. I've edited it to fix it.
    – Dimitri
    Nov 27, 2009 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.