ios - 如何在Apple Watch上继续收集运动传感器数据?

标签 ios swift apple-watch gyroscope core-motion

我正在苹果 watch 上开发一个应用程序,它需要持续访问陀螺仪和加速度计数据。但是一旦 watch 旋转,屏幕就会关闭,并且显然在屏幕关闭时它会停止访问运动数据。我试图让屏幕保持打开状态,但 Apple Watch 没有该功能,对此有何想法? 谢谢

最佳答案

您需要启动 HKWorkoutSession .

The app can continue to access data from Apple Watch’s sensors in the background, letting you keep the app up to date at all times. For example, a running app can continue to track the user’s heart rate, ensuring that the most recent heart rate data is displayed whenever the user raises their wrist.

关于ios - 如何在Apple Watch上继续收集运动传感器数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57173013/

相关文章:

ios - 闪存生成器 4.6。如何减小 IOS 的移动应用程序大小。

swift - "_"不可转换为 Int32 - Swift

ios - 是否可以在 init() 之外使用 JSONDecoder() 来更新对象的属性?

ios - 有什么方法可以向 Apple Watch 提供有关交互式通知的反馈?

ios - iOS 11 中的 Apple Watch 上缺少通知图标

ios - 连接苹果 watch 来解析通知?

ios - 更改包 ID 后推送通知不起作用

ios - 使用 JSQMessagesViewController 时出错

ios - 在 swift 中从 HTML 字符串创建 PDF 文件时如何设置 pdf 中的底部空间?

ios - 是否可以创建一个仅显示网站的 webview 的 ios 应用程序?