我要值添加到苹果手表通知(当前屏幕采用硬编码数据):Apple关注通知载荷
我想补充的值是这些字段:“金额” ,“At”和“When”。我如何添加从PushNotificationPayload.apns文件中获取这些值并在通知中显示它?
这是PushNotificationPayload.apns文件:
{
"aps": {
"alert": {
"body": "New Transaction\n\n",
"title": "Optional title"
},
"category": "newTransactionCategory"
},
"WatchKit Simulator Actions": [
{
"title": "Details",
"identifier": "transactionDetailsButtonAction"
}
],
"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."
}
喜@ DH14-S L,我想试试您的解决方案。不过目前我遇到运行自定义长外观通知的问题。我已经在这里发布错误:http://stackoverflow.com/questions/29341051/how-to-avoid-this-error-took-too-long-to-show-custom-notification-falling-bac/29345228# 29345228 – user1872384 2015-03-31 07:14:30
确保Storyboard和Payload中的'category'键是正确的。然后检查你是否在'willActivate'上写了任何长时间运行的代码。 – Dhawal 2015-03-31 07:37:39
不幸的是,它仍然没有解决错误。 :(即使创建一个新的项目,并设置一个新的watchkit目标与启用自定义通知也会给这个错误以及...这是如此令人沮丧... – user1872384 2015-03-31 07:41:38