我想推送通知发送到我的应用程序中包含自定义数据的JSON格式,但我不知道如何从中提取数据,或者如果连我的JSON格式是正确的。 (我认为这是因为解析将其发送成功)
从JSON解析:
{
"aps": {
"badge": 1,
"alert": "Test",
"sound": ""
},
"url": "http://www.google.com"
}
的appdelegate:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: NSDictionary!) {
var notificationPayload: NSDictionary = userInfo["url"] as NSDictionary!
if (notificationPayload["url"] != nil) {
var url = notificationPayload["url"] as String
var feed: FeedTableViewController = navigation.viewControllers[0] as FeedTableViewController
feed.messages.append(url)
feed.sections.append("url")
}else {
PFPush.handlePush(userInfo)
}
}