我们正在使用kinvey业务逻辑来推送postSave上的通知: 以下是从订婚中发送的内容:
{
"aps": {
"alert": "Hello World",
"sound": "default"
},
}
答案 0 :(得分:2)
aps
结构作为嵌套对象传递到userInfo
appDelegate方法中可用的didReceiveRemoteNotification
对象上。您可以在Swift中使用它:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
if let notification = userInfo["aps"] as? NSDictionary,
let alert = notification["alert"] as? String {
// do something with 'alert'
(来自http://www.intertech.com/Blog/push-notifications-tutorial-for-ios-9/的代码段)