6

我正在为 Apple Watch 编写一个扩展程序,其目的是引导用户完成一系列步骤。我没有手表来测试扩展程序,但我需要确保屏幕始终保持打开状态,直到完成所有步骤。

有谁可以告诉我 Apple Watch 显示屏何时关闭,或者是否有任何方法可以防止显示屏关闭(类似于 iOS 中 UIApplication 的 idleTimerDisabled)?

4

3 回答 3

7

There is currently no way to programmatically prevent the display from being turned off. Otherwise, we can speculate that as long as the user is interacting with your app, the screen will remain on. Worst case, you'll receive a didDeactivate when the app is suspended and a willActivate when the user wakes it up to continue (assuming the Watch app isn't terminated in between).

于 2015-04-07T17:39:46.767 回答
5

从 watchOS 4 开始,您可以使用此布尔值来保持显示屏打开,这将在手臂转动时旋转 UI。

https://developer.apple.com/documentation/watchkit/wkextension/2868464-isautorotating

于 2017-10-26T01:29:41.927 回答
0

考虑HKWorkout

它确保您的应用在用户查看手表时出现

https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings

于 2021-07-20T12:20:07.910 回答