gpt4 book ai didi

ios - WatchOS 2 : haptic

转载 作者:行者123 更新时间:2023-12-01 16:28:10 25 4
gpt4 key购买 nike

我有一个关于制作 Apple Watch 应用程序的问题。 (使用 watchOS 2)
我想制作一个类似于 Apple 的“锻炼” watch 应用程序的健身应用程序。

我在 WKInterfaceDevice 类中测试了一个触觉 API。

- (void)playHaptic:(WKHapticType)type;

它在 Apple Watch 事件状态下工作。 (Apple Watch 的屏幕已开启。)
但我在 Apple Watch 非事件状态下没有收到任何触觉反馈。 (Apple Watch 的屏幕已关闭。)

Q1。我想在背景中接收触觉反馈,例如锻炼应用程序。

Q2。我想在后台将 iPhone 应用程序的触觉反馈发送到 Watch 应用程序(使用 WatchConnectivity)。

你能告诉我如何在后台(非事件)状态下使用“playHaptic:”方法吗?

请帮忙!

最佳答案

watch 应用程序不会在后台运行。一旦用户停止与应用程序交互并且 watch 变为空白,应用程序就会暂停。它不能被 iOS 应用程序调用。锻炼 watch 应用程序是一个特例。

https://developer.apple.com/library/watchos/documentation/General/Conceptual/WatchKitProgrammingGuide/iOSSupport.html

iOS 端对通知的控制有限。当通知发送到satch时,用户可以通过点击通知轻松打开相关的 watch 应用程序。

https://developer.apple.com/library/watchos/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html

关于ios - WatchOS 2 : haptic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34055364/

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