简体   繁体   English

如何在 iPhone 开机或关机时通知您的应用程序?

[英]How to have your app notified whenever iPhone is turned on or will be turned off?

Is there any way my app can be notified (even if it's not in use or background) whenever the user turns his iPhone on and a few moments before it is turned off?有什么办法可以在用户打开他的 iPhone 和关闭前几分钟通知我的应用程序(即使它不在使用或后台)? Thank you since now.谢谢你从现在开始。 This is needed in order to know how much time has the phone been off.这是需要的,以便了解电话关闭了多长时间。

I haven't tried it, and it's obviously hard to debug to find out what is happening.我没有尝试过,显然很难调试以找出发生了什么。 It would make sense that your app is moved to the background.将您的应用程序移至后台是有道理的。 If it is in the background, it shouldn't really matter whether the phone is turned on or off.如果它在后台,则手机是打开还是关闭并不重要。

You can look at file encryption;你可以看看文件加密; if the user uses a passcode then you will be notified when encrypted files cannot be accessed anymore, and when they can again be accessed.如果用户使用密码,那么您将在无法再访问加密文件时以及何时可以再次访问时收到通知。 That will happen when the phone is turned off or on.当手机关机或开机时会发生这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM