Xamarin IOS Push Killed应用程序
按=>
{{ aps = { alert = { "loc-args" = ( ); "loc-key" = "new_chat"; }; "content-available" = 1; id = 3; message = Aaa; sound = default; subject = "new_chat"; type = chat; };
}}
当应用程序被杀死并且我收到推送通知时,它会显示文本“new_chat”。 如何将其更改为其他文本?
假设您的目标是iOS 10+,您可以将Notification Services扩展应用程序( UNNotificationServiceExtension
)添加到您的应用程序包中。
在将远程通知传递给用户之前修改其内容。
在DidReceiveNotificationRequest
覆盖中,从UNNotificationRequest
提取您的内容并对其进行修改并通过提供的contentHandler返回它。
需要阅读以了解如何/何时使用扩展程序:
- 修改新传递的通知中的内容
也:
Xamarin Docs: Xamarin.iOS中的iOS扩展
Apple文档: UNNotificationServiceExtension