当iPhone进入待机模式时,iPhone应用程序会发生什么? [英] What happens to an iPhone app when iPhone goes into stand-by mode?

查看:242
本文介绍了当iPhone进入待机模式时,iPhone应用程序会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用NSTimer,看起来当iPhone进入待机模式(通过按硬件按钮或空闲计时器)时,NSTimer不会触发。

My app uses NSTimer and it appears that NSTimer doesn't fire when the iPhone goes into the stand-by mode (either by pressing the hardware button or by the idle timer).

当我再次激活iPhone时,我的应用程序仍然在前台。

When I activate the iPhone again, my app is still in the foreground. What happens to third party apps when the iPhone is the stand-by mode?

推荐答案

虽然在这里不是很明显,但我相信第三方应用程序原始海报通过发起主题(此处)找到了他的问题的答案iPhone开发者论坛(我最终不得不找到自己,因为信息不在这里分享)。

Although it's not evident here, I believe the original poster did find an answer to his question by starting a thread (available here) in the iPhone Developer Forums (which I eventually had to find myself because the information wasn't shared here).

如果别人有同样的问题,未来,这是一个有帮助的反馈,是由人在苹果论坛上发布的名为eskimo1(我已经略微编辑,以便更容易阅读,而无需整个原始的线程提供的上下文):

In case someone else has the same question and finds the page in the future, here's a helpful response that was posted by someone on the Apple forum called "eskimo1" (which I have edited slightly such that it is easier to read without having the context provided by the entire original thread):

  • Regarding iPhone app status terminology, "active" does not mean "awake", it means "attached to the GUI". Think of it being analogous to "frontmost" in Mac OS X. When you lock the device your app deactivates but the device may or may not go to sleep
  • iPhone OS rarely sleeps if the device is connected to main power (i.e., via USB). It can sleep if running on battery, however.
  • A short time after the screen is locked (20 seconds according to Oliver Drobnik), the device sleeps. This is like closing the lid on your laptop; all activity on the main CPU halts.
  • This does not happen if the device is playing audio in the right audio session. See DTS Q&A QA1626 "Audio Session - Ensuring audio playback continues when screen is locked" for details.
  • Note that the idleTimerDisabled property (which can be turned on to prevent the screen from turning off while the app is running) is about locking the screen after user inactivity. It's not directly related to system sleep (it's indirectly related in that the system may sleep shortly after it's locked).

这篇关于当iPhone进入待机模式时,iPhone应用程序会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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