问题描述
推=>
{{
aps = {
alert = {
"loc-args" = (
);
"loc-key" = "new_chat";
};
"content-available" = 1;
id = 3;
message = Aaa;
sound = default;
subject = "new_chat";
type = chat;
};
}}
当应用程序被终止并且我收到推送通知时,它会显示文本new_chat".如何将其更改为其他文本?
When the application is killed and I receive a push notification it is shown with the text "new_chat". How can I change it to another text?
推荐答案
假设您的目标是 iOS 10+,您可以将通知服务扩展应用程序 (UNNotificationServiceExtension
) 添加到您的应用程序包中.
Assuming you are targeting iOS 10+, you can add a Notification Services extension app (UNNotificationServiceExtension
) to your app bundle.
>
在发送给用户之前修改远程通知的内容.
在 DidReceiveNotificationRequest
覆盖中,从 UNNotificationRequest
中提取您的内容并修改它并通过提供的 contentHandler 返回它.
In the DidReceiveNotificationRequest
override, extract your content from the UNNotificationRequest
and modify it and return it via the contentHandler provided.
需要阅读以了解如何/何时使用扩展:
Required reading to understand how/when the extension is used:
还有:
Xamarin 文档:Xamarin.iOS 中的 iOS 扩展
Xamarin Docs: iOS Extensions in Xamarin.iOS
Apple 文档:UNNotificationServiceExtension
这篇关于Xamarin IOS Push Killed 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!