当应用程序在后台运行时从加速度计获取数据
所以我需要我的 iPhone 应用程序在后台运行并从加速度计收集数据。尽管我设法通过播放背景音乐来完成前者,但当应用程序不在前台时,加速计似乎停止向应用程序发送数据。
有什么解决方法吗?
我发现有一个技巧可以让它不进入睡眠状态:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
...但我的问题是,当另一个应用程序运行时,我必须运行并查看另一个应用程序的 GUI。
谢谢。
PS 我知道应用程序商店会拒绝我的申请。我的项目仅用于演示目的。
So I need my iphone application to run in the background and collect data from the accelerometer. Even though I managed to do the former by playing background music, the accelerometer seems to stop sending data to the application when the app is not in theforeground.
Is there any workaround for this?
I've seen there's a trick to make it not go asleep:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
... but my problem is that I have to run and see the GUI of another application when this other one is running.
Thanks.
P.S. I know the app store would reject my application. My project is only for demostration purposes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论