我想在用户第一次打开我的应用时显示欢迎屏幕.有什么方法可以检查
Swift中第一次启动应用程序?
解决方法
斯威夫特4
func isAppAlreadyLaunchedOnce()->Bool{ let defaults = UserDefaults.standard if let _ = defaults.string(forKey: "isAppAlreadyLaunchedOnce"){ print("App already launched") return true }else{ defaults.set(true,forKey: "isAppAlreadyLaunchedOnce") print("App launched first time") return false } }
注意:在用户重新安装应用程序并首次启动后,此方法将返回false.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。