为了(至少部分地)保护我的应用程序中显示的数据,我想要求用户每次查看应用程序时都要登录。我有一个名为Keeper的类似应用程序,当应用程序首次打开时以及当用户将应用程序从后台运行时返回时需要登录,但不同之处在于,当它从后台返回时,它会在用户重新启动前一个视图登录。我将如何处理此要求?我想使用touchID,但实际上我想我会使用4位密码作为备份。谢谢!
答案 0 :(得分:1)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
showLoginView()
return true
}
func applicationWillEnterForeground(application: UIApplication) {
// This gets called when the app comes back from Background
showLoginView()
}
func applicationDidBecomeActive(application: UIApplication) {
// NOTE: You don't want to call showLoginView() here
// Because this gets called even when the app becomes active after user drags down Notification Center, or drags up Utility Panel.
}
答案 1 :(得分:0)
在" applicationDidBecomeActive:"中打开您的登录对话框; appDelegate中的方法。