【发布时间】:2015-04-07 06:12:31
【问题描述】:
处理 Apple Watch 通知:- 所以如果我在通知界面中添加按钮(来自对象 Lib),那么错误是:
通知界面不支持按钮
PushNotificationPayload.apns 有 WatchKit Simulator Actions 像这样:
"WatchKit Simulator Actions":
[
{
"title": "View",
"identifier": "firstButtonAction"
}
],
模拟器会向我展示这个
现在我的问题是,当从服务器发送PushNotification 时,我该如何处理这个View 按钮,
如果 aps 文件包含操作按钮是 Apple Watch 的唯一选项,
如何通过指定的Key从服务器发送通知字典?
如何更改操作按钮的背景颜色?
谁能给我样品aps文件,其中包括ActionButton,用于设备the Apple Watch而不是Simulator
我只是通过将WatchKit Simulator Actions 键更改为WatchKit Actions 键进行测试,但它没有显示操作按钮。
正如@vivekDas 在答案中所建议的,我通过将aps 替换为:
"alert" : {
"body" : "Acme message received from Johnny Appleseed",
"action-loc-key" : "VIEW",
"action" : [
{
"id" : "buttonTapped",
"title" : "View"
}
]
}
但 Xcode 中的模拟器确实显示了一个操作按钮。
我认为这可能在设备Apple Watch 上运行,这是...?
您对此有何建议。
【问题讨论】:
-
您无法在模拟器中查看推送通知。
-
嘿有同样的问题...你设法解决了吗?
标签: ios iphone push-notification watchkit apple-watch