【发布时间】:2015-05-23 16:58:59
【问题描述】:
在 Xcode 中创建新的 Apple Watch 应用时,会创建以下 APNS 有效负载示例:
{
"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 提供了使用后一种变体的屏幕截图。
【问题讨论】:
-
我可以确认第一个变体确实有效。这就是我们用于有效载荷的形式。我们的应用已在商店中上线。
-
是的,但我可以确认第二个也可以。
标签: ios apple-push-notifications watchkit