相关疑难解决方法(0)

如何处理推送通知中的操作按钮

处理Apple Watch通知: -如果我在通知界面中添加按钮(来自对象Lib),那么错误是:

通知界面中不支持按钮

PushNotificationPayload.apns有WatchKit Simulator Actions这样的:

"WatchKit Simulator Actions": 
[
    {
        "title": "View",
        "identifier": "firstButtonAction"
    }
],
Run Code Online (Sandbox Code Playgroud)

和模拟器向我显示这个

在此输入图像描述

现在我的问题是,从服务器View发送时如何处理此按钮PushNotification,

如果aps文件包含操作按钮是Apple Watch的唯一选项,

如何使用指定的密钥从通知字典中的服务器发送它?

如何更改动作按钮BG颜色?

会不会有人请给我的样本aps文件,其中包括ActionButton对设备the Apple Watch不为Simulator

我只是通过将WatchKit Simulator ActionsKey 更改为Key来测试,WatchKit Actions但它没有显示Action Button.

正如答案中的@vivekDas所建议的,我通过替换aps为:

"alert" : {
     "body" : "Acme message received from Johnny Appleseed",
     "action-loc-key" : "VIEW",
     "action" : [
        {
           "id" : "buttonTapped",
           "title" : …
Run Code Online (Sandbox Code Playgroud)

iphone push-notification ios apple-watch watchkit

14
推荐指数
2
解决办法
1万
查看次数

标签 统计

apple-watch ×1

ios ×1

iphone ×1

push-notification ×1

watchkit ×1