屏幕锁定时启用 iPhone 加速计

发布于 2024-08-26 14:32:31 字数 231 浏览 6 评论 0原文

因此,显然可以在屏幕锁定时让处理器继续处理内容,如下所示:

在睡眠模式下运行 iPhone 应用

但是,在使用示例代码进行测试后,一旦设备锁定,UIAccelerometer 就会停止提供值。有没有办法强制其他方式?

So apparently it is possible to keep the processor going processing stuff while the screen is locked, as indicated here:

Running IPhone apps while in sleep mode

However, after testing with the example code, UIAccelerometer will just stop giving value as soon as the device is locked pronto. Is there a way to force otherwise?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谈下烟灰 2024-09-02 14:32:31

3.1.2 之前的 iPhone 操作系统中存在一个错误,导致屏幕黑屏后加速计停止返回值。您可能会遇到同样的问题。我向 Apple 提交了一个关于此问题的错误,他们在 3.1.2 中修复了它。

我在应用程序中使用的一个技巧是启用接近传感器。这允许我的应用程序继续运行,但如果用户将手机放入口袋或以其他方式触发传感器,屏幕将关闭并且不消耗电量。同时,我的应用程序仍在运行,并且(3.1.2 或更高版本)加速计继续发送更新。

There was a bug in iPhone OS prior to 3.1.2 that caused the accelerometer to stop returning values as soon as the screen was blanked. You may be running into this same issue. I filed a bug with Apple about it and they fixed it in 3.1.2.

One trick I use in an app is to enable the proximity sensor. This allows my app to continue running, but if the user puts their phone in their pocket or otherwise trips the sensor, the screen turns off and doesn't consume power. Meanwhile, my app is still running and (3.1.2 or later) the accelerometer continues sending updates.

我还没有尝试过这个,但如果你厌倦了这个解决方法并且它不起作用,那么苹果可能修补了这个黑客。提供解决方法的链接来自 9 月 9 日,此后我们至少进行了一次操作系统更新。

I haven't tried this but if you've tired the workaround and it didn't work then it's possible that Apple patched out the hack. The link that gives the work around is from Sept 09 and we've had at least one OS update since then.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文