是否可以在通知服务扩展中获取 apns-collapse-id?
Is it possible to get apns-collapse-id in the notification service extension?
我正在尝试访问 apns-collapse-id
以根据某些条件更改通知的内容。 apns-collapse-id
可以在扩展中访问吗?
发布后立即找到答案。
identifier
就是您正在寻找的 属性。
来自文档:
Use this string to identify notifications in your app. For example,
you can pass this string to the
removePendingNotificationRequests(withIdentifiers:) method to cancel a
previously scheduled notification. ...
For local notifications, this property is set to the value passed to
the request’s initializer (see the init(identifier:content:trigger:)
method). For remote notifications, it is set to the value of the
apns-collapse-id key that you specified in the APNs request header
when generating the remote notification. If no value is set, the
system automatically assigns an identifier.
我正在尝试访问 apns-collapse-id
以根据某些条件更改通知的内容。 apns-collapse-id
可以在扩展中访问吗?
发布后立即找到答案。
identifier
就是您正在寻找的 属性。
来自文档:
Use this string to identify notifications in your app. For example, you can pass this string to the removePendingNotificationRequests(withIdentifiers:) method to cancel a previously scheduled notification. ...
For local notifications, this property is set to the value passed to the request’s initializer (see the init(identifier:content:trigger:) method). For remote notifications, it is set to the value of the apns-collapse-id key that you specified in the APNs request header when generating the remote notification. If no value is set, the system automatically assigns an identifier.