我想创建的第一次应用程序打开的设备上,但我有一些麻烦与代码的警报。这是我到目前为止,任何帮助,将不胜感激我想创建的第一次应用程序打开警报
// alert first time app is opened
// making of alert
let alert = UIAlertController(title: "Navigation", message: "Tap Right Hand Side of Screen For Next Quote, Left Hand Side To Go Back", preferredStyle: UIAlertControllerStyle.alert)
//add ok button
alert.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.default, handler: nil))
// detect if first launch
let launchedBefore = UserDefaults.standard.bool(forKey: "launcedBefore")
if launchedBefore {
}
else {
self.present(alert, animated: true, completion: nil)
UserDefaults.standard.set(true, forKey: "launchedBefore")
}
这就是我想要放置代码
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
把警报在'中的AppDelegate –
didFinishLaunchingWithOptions'功能“但我有一些麻烦的代号为”什么烦恼到底是什么? – Larme
“launcedBefore”!=“launchBefore” –