开发者

How to show a message only the first time an app is launched?

Is there an easy way to have an alert appear only the first time an app is launched, or will I ha开发者_JAVA技巧ve to do it manually by making a BOOL and having it set to FALSE after it's run the first time?


Sounds easy enough...

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

if(![defaults boolForKey:@"hasBeenLaunchedBefore"]) {
  //Show alert
  [defaults setBool:YES forKey:@"hasBeenLaunchedBefore"];
  [defaults synchronize];
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜