tags:

views:

70

answers:

1

Hi,
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!

+3  A: 

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"];
}

Dimitri
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.
Carl Coryell-Martin
Whoops, you are right. It's probably best to change the key name too. I've edited it to fix it.
Dimitri