锁屏iPhone
我的问题很简单(我认为并希望)。我想知道当我锁定手机时会发生什么。 我制作了一个类似时钟的小应用程序,它应该在给定时刻(假设 18:00)播放并循环播放声音。但是当我按下电源按钮并且手机锁定时,在 18:00 没有任何反应。当我在 18:05 再次按下电源按钮并显示“锁定屏幕”时,然后播放声音。
请注意,在锁定手机之前我没有返回主屏幕。当我解锁应用程序时,该应用程序仍然打开。 即使我锁定了屏幕,是否有某种方法可以让应用程序仍然执行其操作?或者这只是我可能犯的一个编程错误?
问候, 保罗·皮伦
My question is quite simple (I think and hope). I would like to know what happens when I lock my phone.
I made a little clock-like app which should play and loop a sound at a given moment (lets say 18:00). But when I press the power button, and the phone locks, nothing happens at 18:00. When I press the power button again 18:05 and the "lock screen" shows, then the sound is played.
Please note, I didn't return to the home screen before locking the phone. The app is still open, when I unlock the app is shown.
Is there some way to let the app still do its thing eventhough I locked the screen? Or is this just a programming error I might have made?
Regards,
Paul Peelen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该查看有关应用程序委托的 applicationWillResignActive: 和 applicationDidBecomeActive: 方法的信息。您可以在 iPhone 应用程序编程指南中找到此信息。另外,请查看同一指南中有关“自动睡眠定时器”的信息。
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW59
我认为您可以使用此信息回答您自己的大部分问题,但请发布您可能有的任何后续问题。
巴特
You should take a look at information about the application delegate’s applicationWillResignActive: and applicationDidBecomeActive: methods. You can find this information in the iPhone Application Programming Guide. Also, take a look at information about "The Automatic Sleep Timer" in the same guide.
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW59
I think you can answer most of your own questions with this information but please post any follow up questions that you might have.
Bart