我正在为iOS 9beta开发推送通知应用程序 - 使用xcode 7 beta 6观看OS 2测试版...我已经完成了苹果文档中提到的所有设置,但我只在我的iPhone应用程序中接收推送通知而不是在观看 . 即使我的iPhone应用程序没有在前台运行,我仍然会在iPhone上收到一声嘟嘟声,但是没有任何关注 . 这是由服务器推送的有效载荷结构:
{
"aps": {
"alert": {
"body": “Notification Body",
"title": “Notification Title"
},
"category": "MessageCategory",
"badge" : 1,
"sound" : "default"
},
"WatchKit Simulator Actions": [
{
"title": "View",
"identifier": "ViewAction"
}
],
"callVolume": {
"BU 1": 25,
"BU 2": 30,
"BU 3": 45,
"BU 4": 50,
"BU 5": 60
}
}
我可以运行“Notification - WatchApp”目标并查看动态接口加载 . 但是当收到推送通知时,覆盖func didReceiveRemoteNotification(remoteNotification:[NSObject:AnyObject],withCompletion completionHandler:((WKUserNotificationInterfaceType) - > Void))不是触发 .
我错过了什么吗?提前致谢 .
1 回答
我找到了我的问题的答案 . 这是我正在使用的有效载荷结构 .
{“aps”:{
}
根据我们在UIUserNotificationSettings中为UIMutableUserNotificationAction注册的 Headers 显示按钮 Headers .