ios - Apple Push Notifications - 将数据放入应用程序

标签 ios push-notification apple-push-notifications

是否可以将额外数据放入 APN 负载并在启动后在应用中读取?

最佳答案

是的,它是一个 JSON 字典。

{
"aps":
    {"alert":"test",
    "badge":1,
    "sound":"default"
    },
"Value1":info,
"Value2":3,
  "myDict":
   {
     "key1":"val1",
     "key2":val2
   }
}

并访问:

- (void)receivedRemoteNotification:(NSDictionary *)userInfo {

NSDictionnary *myDict = [userInfo valueForKeyPath:@"aps.myDict"];

}

关于ios - Apple Push Notifications - 将数据放入应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5310292/

相关文章:

iOS Swift 描边宽度

iphone - 显示 UILabel 动画

ios - 是否有将数字转换为十六进制字符串的快速 native 函数?

ios - 无法在 iOS 上的 Azure NotificationHub 中注册设备,无回调

ios - 无法将通知推送到 iOS9 设备

ios - 如何在 firebase 控制台中为 APNs 使用 Apple 的新 .p8 证书

c# - AuthenticateAsServer 不接受 PEM 格式的证书

ios - 循环遍历值事件类型并使用 Firebase 快速创建值 UIButton 的 titleLabel

iphone - 如何更新推送通知的配置文件 - IOS

IOS DidReceiveRemoteNotification 问题