jpush 服务端SDK设置推送目标的tag字段问题

qyvlik
7年前 1.3k 0

客户端 A 注册 tag A,客户端 B 设置 tag B,客户端 C 设置 tag B,没有客户端注册过 tag C

然后我自己的服务端推送时,指定 tag为 ['A', 'B', 'C'],然后错,是不是因为 C 没有注册到 jpush 服务端。

推送指定的 tag 集合,其中的元素一定要在 jpush 上注册过吗?

推送了两个

发送的payload 1

{
    "platform": "all",
    "audience": {
        "tag": ["zh-Hans-CN", "zh-Hans"]
    },
    "notification": {
        "android": {
            "alert": "4",
            "extras": {
                "titleEn": "4",
                "title": "4",
                "url": "",
                "content": "4",
                "contentEn": "4"
            }
        },
        "ios": {
            "alert": "4",
            "extras": {
                "titleEn": "4",
                "title": "4",
                "url": "",
                "content": "4",
                "contentEn": "4"
            },
            "badge": "1",
            "sound": ""
        }
    },
    "options": {
        "sendno": 2111129901,
        "apns_production": false
    }
}

报错如下:

2017-03-30 15:45:57.517 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.518 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.518 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.519 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.602 [http-bio-8080-exec-4] WARN  c.j.c.c.NativeHttpClient - Got error response - responseCode:400, responseContent:{"error": {"message": "The tag has invalid character", "code": 1003}}
2017-03-30 15:45:57.603 [http-bio-8080-exec-4] ERROR c.j.c.c.NativeHttpClient - Your request params is invalid. Please check them according to error message.
2017-03-30 15:45:57.606 [http-bio-8080-exec-4] ERROR c.rich.modules.push.JPushService - sendPush fail : request error:{}
cn.jiguang.common.resp.APIRequestException: {"error": {"message": "The tag has invalid character", "code": 1003}}

发送的payload 2

{
    "platform": "all",
    "audience": {
        "tag": ["en_US"]
    },
    "notification": {
        "ios": {
            "alert": "4",
            "extras": {
                "titleEn": "4",
                "title": "4",
                "url": "",
                "content": "4",
                "contentEn": "4"
            },
            "badge": "1",
            "sound": ""
        },
        "android": {
            "alert": "4",
            "extras": {
                "titleEn": "4",
                "title": "4",
                "url": "",
                "content": "4",
                "contentEn": "4"
            }
        }
    },
    "options": {
        "sendno": 23767963,
        "apns_production": false
    }
}

报错如下:

2017-03-30 15:45:57.615 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.616 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.616 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.617 [http-bio-8080-exec-4] INFO  c.j.c.c.NativeHttpClient - Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
2017-03-30 15:45:57.695 [http-bio-8080-exec-4] WARN  c.j.c.c.NativeHttpClient - Got error response - responseCode:400, responseContent:{"msg_id": 4746190756, "error": {"message": "cannot find user by this audience", "code": 1011}}
2017-03-30 15:45:57.696 [http-bio-8080-exec-4] ERROR c.j.c.c.NativeHttpClient - Your request params is invalid. Please check them according to error message.

1个回答

热门排序
  • 提示的是非法tag而不是1011没有目标不是吗?

    所以是参数的问题。

    传多个tag进行推送,不会因为其中一个没有目标而报错1011.