接收推送通知时的有效负载是什么? [iOS]
What is the payload for while receiving push notification ? [iOS]
由于未知原因,我无法运行在开发环境中推送通知。它没有显示,因此我无法在我的 iOS 设备上 运行 我的应用程序来检查某些字段。在生产中,推送通知工作正常。
我现在遇到的问题是我想使用通知负载中的 "userId" 导航到某个页面。我不知道那个有效载荷的结构。任何人都可以指出 Applozic 服务器正在发送的有效载荷的结构吗?
let dictionary = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? [String: Any]
这本词典是用什么做的?
非常感谢您的帮助。
For group chat, the dictionary looks like this:
{
"AL_KEY" = "**msgtype**";
"AL_VALUE" = "{\"id\":\"**appIDhere**\",\"type\":\"**msgtype**\",\"message\":\"**AL_GROUP:groupid:userid**\",\"notifyUser\":true,\"totalUnreadCount\":0,\"sendAlert\":false,\"messageMetaData\":{}}";
aps = {
alert = "**groupname\nuserid: messagecontent**";
badge = 127;
"content-available" = 1;
sound = default;
};
}
For One - to - One chat,
{
"AL_KEY" = "**msgtype**";
"AL_VALUE" = "{\"id\":\"**appIDhere**\",\"type\":\"**msgtype**\",\"message\":\"**userid**\",\"notifyUser\":true,\"totalUnreadCount\":128,\"sendAlert\":true,\"messageMetaData\":{}}";
aps = {
alert = "**userid**: **messagecontent**";
badge = 128;
"content-available" = 1;
sound = default;
};
}
星号内的名称将被替换为适当的值。
希望对你有用。
已编辑:
在这里你可以检查 AL_KEY 和 APPLOZIC_01 收到的消息然后在 AL_VALUE 你可以得到消息。
一对一消息和群聊消息两种类型
1) 对于群聊,您可以检查是否可以使用 : 拆分它的第一部分字符串是否有 AL_GROUP 然后是它的组消息,第二部分是 groupId,第三部分是在该组中发送消息的 userId
2)对于一对一,只有一个部分是一对一聊天中发送消息的用户ID
由于未知原因,我无法运行在开发环境中推送通知。它没有显示,因此我无法在我的 iOS 设备上 运行 我的应用程序来检查某些字段。在生产中,推送通知工作正常。
我现在遇到的问题是我想使用通知负载中的 "userId" 导航到某个页面。我不知道那个有效载荷的结构。任何人都可以指出 Applozic 服务器正在发送的有效载荷的结构吗?
let dictionary = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? [String: Any]
这本词典是用什么做的?
非常感谢您的帮助。
For group chat, the dictionary looks like this:
{
"AL_KEY" = "**msgtype**";
"AL_VALUE" = "{\"id\":\"**appIDhere**\",\"type\":\"**msgtype**\",\"message\":\"**AL_GROUP:groupid:userid**\",\"notifyUser\":true,\"totalUnreadCount\":0,\"sendAlert\":false,\"messageMetaData\":{}}";
aps = {
alert = "**groupname\nuserid: messagecontent**";
badge = 127;
"content-available" = 1;
sound = default;
};
}
For One - to - One chat,
{
"AL_KEY" = "**msgtype**";
"AL_VALUE" = "{\"id\":\"**appIDhere**\",\"type\":\"**msgtype**\",\"message\":\"**userid**\",\"notifyUser\":true,\"totalUnreadCount\":128,\"sendAlert\":true,\"messageMetaData\":{}}";
aps = {
alert = "**userid**: **messagecontent**";
badge = 128;
"content-available" = 1;
sound = default;
};
}
星号内的名称将被替换为适当的值。 希望对你有用。
已编辑:
在这里你可以检查 AL_KEY 和 APPLOZIC_01 收到的消息然后在 AL_VALUE 你可以得到消息。
一对一消息和群聊消息两种类型
1) 对于群聊,您可以检查是否可以使用 : 拆分它的第一部分字符串是否有 AL_GROUP 然后是它的组消息,第二部分是 groupId,第三部分是在该组中发送消息的 userId
2)对于一对一,只有一个部分是一对一聊天中发送消息的用户ID