当手表屏幕变黑(锁定)时,我似乎无法获得任何心率数据.我将调用applicationWillResignActive然后心率数据停止.
当屏幕锁定时,传感器似乎在一段时间后停用(不再是绿色).
其他人看到这种行为?如果有人在手表上的屏幕被锁定时获得心率数据,我可以发布我的代码来启动WorkoutSession.
解决方法 从watchOS 3.0开始,您可以将带有workout-processingvalue的WKBackgroundModes条目添加到扩展的Info.pList中.从docs:
总结Running in the Background Workout sessions can run in the background.
Background running grants an app the following abilitIEs:The app continues to run throughout the entire workout session,even
when the user lowers their wrist or interacts with a different app.
When the user raises their wrist,the app reappears,letting the user
quickly and easily check their current progress and performance.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 – HKWorkoutSession:在watchOS 2中关闭屏幕时未获得心率全部内容,希望文章能够帮你解决ios – HKWorkoutSession:在watchOS 2中关闭屏幕时未获得心率所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)