gpt4 book ai didi

iphone - UIBackgroundModes 和 UIAccelerometer

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:33:00 29 4
gpt4 key购买 nike

我正在开发一个可以在后台运行的导航应用程序。由于将 UIAccelerometer 设置为 location,所以工作正常。但我也想使用加速度计,以获取有关用户正在做什么的一些额外信息。但是,在后台时,UIAccelerometer 不会调用它的委托(delegate)。

有没有办法在后台获取当前加速度?

最佳答案

我自己找到了解决方案。在后台运行时确实可以获取加速度计数据。只需依赖 CoreMotion 框架,而不是 UIAccelerometer 类,顾名思义,UIAccelerometer 类是用户界面相关的类。

看到这个问题:How Nike+ GPS on iPhone receives accelerometer updates in the background?

关于iphone - UIBackgroundModes 和 UIAccelerometer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9351961/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com