开发者

Determine a first use of an iPhone application

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?)

开发者_StackOverflow社区Thanks!


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜