如何在第一次启动应用时显示消息? [英] How to show a message only the first time an app is launched?

查看:103
本文介绍了如何在第一次启动应用时显示消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以在第一次启动应用时显示警报,或者我是否必须通过制作BOOL并在第一次运行后将其设置为FALSE来手动执行此操作?

Is there an easy way to have an alert appear only the first time an app is launched, or will I have 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];
}

这篇关于如何在第一次启动应用时显示消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆