在WatchKit developer guide , how to render custom notifications 上有说明它还说:
Apps are not required to do anything to support notifications. The system provides a default notification interface that displays the alert message from the notification. However, apps can customize the notification interface and include custom graphics, content, and branding.
我可以获得本地通知以在手机上触发横幅提醒,但它们不会发生在 WatchKit 应用程序上。我尝试使用所有目标进行调试:
- iOS 应用
- 观看应用
- 观看一瞥
- 观看自定义通知
即使电话应用程序在后台,在收到本地通知时似乎也没有触发。我还通过模拟在后台收到的远程通知来尝试此操作。
我希望我不必直接调用 watchKit 的 Controller 本地/远程通知处理程序。
最佳答案
I'm hoping I don't have to call the watchKit's controller local/remote notification handlers directly.
不,你不知道。
答案是 XCode 目前不支持同时调试 Apple Watch 和 iPhone。这就是为什么您不能将通知从 iPhone 模拟器推送到 Watch 模拟器,目前仅支持通过 *.apns
文件进行负载测试。
关于ios - 如何使用 WatchKit 触发通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27097579/