在WatchKit Simulator上向通知添加多个按钮

时间:2015-01-08 08:00:52

标签: watchkit apple-watch

我正在尝试向watchapp上的动态通知屏幕添加Second Button。 但模拟器只显示第一个按钮。

{
"aps": {
    "alert": "Test message",
    "title": "Optional title",
    "category": "myCategory"
},

"WatchKit Simulator Actions": [
                                   {
                                       "title": "First Button",
                                       "identifier": "firstButtonAction"
                                   }
                                   {
                                       "identifier" : "Second Button",
                                       "title" : "secondButtonAction"
                                   },
                               ]

}

1 个答案:

答案 0 :(得分:2)

对于第二项,您将标题标记为标识符,反之亦然。此外,您在“WatchKit Simulator Actions”数组中缺少两个对象之间的逗号。请参阅json.org

处的语法
"WatchKit Simulator Actions": [
                               {
                                   "title": "First Button",
                                   "identifier": "firstButtonAction"
                               },
                               {
                                   "title": "Second Button",
                                   "identifier": "secondButtonAction"
                               },
                           ]

}