加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – 手表套件:是否可以以编程方式振动手表?

发布时间:2020-12-15 01:58:13 所属栏目:百科 来源:网络整理
导读:观看扩展程序运行时是否可以振动手表?我们可以在iOS上这样做(强制iPhone振动): AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 我希望在WatchKit上有类似的东西。 更新:我已经向苹果雷达添加了问题并收到了答案: Engineering has determined th
观看扩展程序运行时是否可以振动手表?我们可以在iOS上这样做(强制iPhone振动):

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

我希望在WatchKit上有类似的东西。

更新:我已经向苹果雷达添加了问题并收到了答案:

Engineering has determined that your bug report (20019274) is a duplicate of another issue (19025053) and will be closed.

19025053仍然开放。

更新2:AudioServicesPlayAlertSound()无法在任何声音ID的手表模拟器上工作。似乎不支持功能。

解决方法

如果您目标WatchOS 2.0,您现在可以要求Watch振动

要做到这一点,你需要做的是在任何WKHapticType的WKInterfaceDevice实例上调用playHaptic。在下面的例子中,它将播放通知触觉。

WKInterfaceDevice().playHaptic(.Notification)

你可以进一步阅读
Apple WKInterfaceDevice Documentation

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读