ios - 如何使用 WatchKit 触发通知

标签 ios watchkit apple-watch

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 应用程序上。我尝试使用所有目标进行调试:

  1. iOS 应用
  2. 观看应用
  3. 观看一瞥
  4. 观看自定义通知

即使电话应用程序在后台,在收到本地通知时似乎也没有触发。我还通过模拟在后台收到的远程通知来尝试此操作。

我希望我不必直接调用 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/

相关文章:

html - 可以在 Mac、PC 或其他设备上镜像 iOS Safari 调试控制台吗?

ios - 如何使用 Swift 3 在 iOS 9 中设计表单布局

ios - MKAnnotation 不可见*直到*用户拖动 map

ios - 使用 xcode 和 swift 从照片库中选择要显示到 Apple Watch 上的 ImageView 的图像

ios - 用于实时消息传递的 WKExtension 状态和 sendMessage

ios - Watchkit/Xcode 中 Storyboard的渐变

ios - Apple Watch 应用(仅限通知)

ios - 滚动tableView时,如何知道哪个单元格触摸了绿色区域

ios - containerAppExtensionEntitlementsWithCompletion 失败,错误为 : (null)

ios - 可以从 iOS 应用程序打开 watchOS 应用程序吗?