当应用程序在iPhone中进入睡眠模式时,我们可以锁定应用程序吗? [英] Can we lock the app while app goes to sleep mode in IPhone?

查看:125
本文介绍了当应用程序在iPhone中进入睡眠模式时,我们可以锁定应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用包含锁定选项的应用程序。我的应用程序以密码屏幕启动。如果我输入正确的代码,则导航到下一个屏幕。如果我长时间不使用该应用程序,它将进入睡眠模式。当用户现在想要运行应用程序,应该出现密码屏幕并且用户必须再次输入代码。这可能吗?有没有这方面的教程?如果你已经完成它,请不要介意发布相关代码。谢谢你提前。

I am working an app where lock option is included.My app starts with passcode screen.If I enter correct code then it navigates to next screen.If I dont use the app for long time it goes to sleep mode.When the user wants to run the app now, the passcode screen should appear and the user has to enter the code again.Is it possible?Is there any tutorial for this?Please dont mind to post the related code if you have done it.Thanks in advance.

推荐答案

是的,有可能。您必须在Application Delegate中以名为 applicationDidBecomeActive 的方法打开屏幕。每次从后台打开应用程序时都会调用此方法。

Yes ofcourse it is possible. You must open the screen in a method called applicationDidBecomeActive in your Application Delegate. This method is called every time the application is opened from background.

因此,无论何时用户启动已经运行的应用程序,都会调用此方法,您可以先显示此方法密码屏幕,然后是相应的屏幕。

So whenever the user starts the already running app, this method will be called and from this you can first show the Password screen, and after that the respective screen.

这篇关于当应用程序在iPhone中进入睡眠模式时,我们可以锁定应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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