ios - 是否可以在 iOS 通知中隐藏部分消息?

标签 ios amazon-web-services notifications

我正在从 Amazon SNS 向 iOS 设备发送“推送通知”。在发送通知时,我想隐藏 url 并在通知中向用户显示剩余的字符串。

For Instance :

Notification is like this "Hi customers https://www.google.co.in/?gfe_rd=cr&ei=zCyeVbuiMZK_-APxlYHoBA welcome"

Show the notification to the user as "Hi customers welcome"

And i want to store the entire notification message in database.

If user clicks on notification then i have to open that link in embedded browser. But that url will not be visible to the user

是否可以在通知中隐藏消息的某些部分?预先感谢您的帮助。

最佳答案

来自 Apple Push Notification Service :

Providers can specify custom payload values outside the Apple-reserved aps namespace. Custom values must use the JSON structured and primitive types: dictionary (object), array, string, number, and Boolean. You should not include customer information (or any sensitive data) as custom payload data. [...]

文档中提供了一个示例:

{
    "aps" : { "alert" : "Message received from Bob" },
    "acme2" : [ "bang",  "whiz" ]
}

在您的情况下,我建议使用这样的有效负载:

{
    "aps" : { "alert" : "Welcome Customers!" },
    "welcome-url" : "https://www.google.co.in/?gfe_rd=cr&ei=zCyeVbuiMZK_-APxlYHoBA"
}

关于ios - 是否可以在 iOS 通知中隐藏部分消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31311797/

相关文章:

ios - 更正可编码结构 Swift 4 和 KeyNotFound 错误

ios - 红蜘蛛委托(delegate)未被召集

ios - CAGradientLayer 在像素处获取颜色

postgresql - AWS DMS 流复制 : Logical Decoding Output Plugins(test_decoding) not accessible

amazon-web-services - 如何处理关系数据库中的AWS IOT流数据

iphone - 截图前的通知或检测?

android - MIUI 抬头通知不起作用

iOS 右导航按钮不显示在 UINavigationBar 中

amazon-web-services - Grails AWS SDK 插件无法解析 PutObjectRequest

ios - 自定义键盘关闭按钮效果很好,直到焦点转移到另一个文本字段