При создании новой компании Apple App Watch в Xcode, следующий APNS пример полезной нагрузки создаются:Payload для Watch App уведомления
{
"aps": {
"alert": {
"body": "Test message",
"title": "Optional title"
},
"category": "myCategory"
},
"WatchKit Simulator Actions": [
{
"title": "First Button",
"identifier": "firstButtonAction"
}
],
"customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App." }
Я смущен использование тела и названия в предупредительном словаре. В приложениях iOS обычно используется следующая полезная нагрузка:
{
"aps": {
"alert": "Test message",
"title": "Opt title",
"category": "default"
},
"WatchKit Simulator Actions": [
{
"title": "First Button",
"identifier": "firstButtonAction"
}
],
"customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
}
Каков правильный путь? Хотя файл полезной нагрузки по умолчанию создается таким образом, Apple documentation предоставляет скриншот, используя последний вариант.
Я могу подтвердить, что первый вариант действительно работает. Это форма, которую мы используем для наших полезных нагрузок. Наше приложение работает в магазине. – rmp
Да, но я могу подтвердить, что второй тоже работает. – edwardmp