当iPhone进入待机模式时,iPhone应用程序会发生什么? [英] What happens to an iPhone app when iPhone goes into stand-by mode?
问题描述
我的应用程序使用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):
- 关于iPhone应用程序状态术语,活动不意味着唤醒,它意味着附加到GUI。
- iPhone操作系统很少睡觉,如果设备被锁定时,设备可能会被禁用,但不会进入睡眠状态。连接到主电源(即,经由USB)。
- 在屏幕锁定后很短时间(根据Oliver Drobnik的20秒),设备会睡眠。这就像关闭笔记本电脑上的盖子;主CPU的所有活动都会暂停。
- 如果设备在正确的音频会话中播放音频,则不会发生。请参见 DTS Q& A QA1626音频会话 - 确保屏幕播放继续播放音频
- 请注意,idleTimerDisabled属性(可以打开以阻止屏幕在应用程序运行时关闭)是关于锁定屏幕的后用户不活动。它与系统睡眠没有直接的关系(它是间接相关的,因为系统可能会在锁定后不久睡觉)。
- 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屋!