开发者

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

开发者 https://www.devze.com 2023-01-25 09:36 出处:网络
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 fir

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

精彩评论

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

关注公众号