Xamarin IOS Push Killed应用程序 [英] Xamarin IOS Push Killed app
问题描述
Push =>
{{
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+,您可以添加Notification Services扩展程序( UNNotificationServiceExtension
)到您的应用包。
Assuming you are targeting iOS 10+, you can add a Notification Services extension app (UNNotificationServiceExtension
) to your app bundle.
修改远程通知的内容在交付给用户之前。
modifies the content of a remote notification before it is delivered to the user.
在 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:
- Modifying Content in Newly Delivered Notifications
另外:
Xamarin文档: Xamarin.iOS中的iOS扩展程序
Xamarin Docs: iOS Extensions in Xamarin.iOS
Apple docs: UNNotificationServiceExtension
Apple docs: UNNotificationServiceExtension
这篇关于Xamarin IOS Push Killed应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!