【问题标题】:Is it possible to get apns-collapse-id in the notification service extension?是否可以在通知服务扩展中获取 apns-collapse-id?
【发布时间】:2018-12-22 01:22:37
【问题描述】:

我正在尝试访问apns-collapse-id 以根据某些条件更改通知的内容。 apns-collapse-id可以在扩展中访问吗?

【问题讨论】:

    标签: ios apple-push-notifications unnotificationserviceextension


    【解决方案1】:

    发布后立即找到答案。

    identifier 是您要查找的属性。

    来自文档:

    使用此字符串来识别您应用中的通知。例如, 您可以将此字符串传递给 removePendingNotificationRequests(withIdentifiers:) 方法取消一个 之前预定的通知。 ...

    对于本地通知,此属性设置为传递给的值 请求的初始化程序(参见 init(identifier:content:trigger:) 方法)。对于远程通知,它设置为 您在 APNs 请求标头中指定的 apns-collapse-id 键 生成远程通知时。如果没有设置值,则 系统会自动分配一个标识符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-10
      • 2020-08-30
      • 2019-06-12
      • 2020-04-12
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 1970-01-01
      相关资源
      最近更新 更多