Closed alsotang closed 9 years ago
重新登录果然就好了。像我这种已经登录的老用户,有什么办法可以让极光自动注册我的设备吗?
我这里报错长这样:
cnode-0 (out): Push URL :https://api.jpush.cn/v3/push
cnode-0 (out): Body :{"options":{"sendno":2439555405,"apns_production":true},"notification":{"android":{"alert":"alsotang 回复了你的主题","extras":{"topicId":"54d5d35731288f104a80fe58"}},"ios":{"alert":"alsotang 回复了你的主题","sound":"","badge":2,"extras":{"topicId":"54d5d35731288f104a80fe58"}},"alert":"alsotang 回复了你的主题"},"audience":{"alias":["54009f5ccd66f2eb37190485"]},"platform":"all"}
cnode-0 (out): Headers :{"User-Agent":"JPush-API-NodeJS-Client","Connection":"Keep-Alive","Charset":"UTF-8","Content-Type":"application/json"}
cnode-0 (out): Method :POST
cnode-0 (out): Times/MaxTryTimes : 1/3
cnode-0 (out): Push Fail, HttpStatusCode: 400 result: {"msg_id": 730914997, "error": {"message": "cannot find user by this audience", "code": 1011}}
cnode-0 (out): Push URL :https://api.jpush.cn/v3/push
cnode-0 (out): Body :{"options":{"sendno":2320566186,"apns_production":true},"notification":{"android":{"alert":"alsotang 回复了你的主题","extras":{"topicId":"54d5c9dbeef4ca19212633ad"}},"ios":{"alert":"alsotang 回复了你的主题","sound":"","badge":3,"extras":{"topicId":"54d5c9dbeef4ca19212633ad"}},"alert":"alsotang 回复了你的主题"},"audience":{"alias":["54009f5ccd66f2eb37190485"]},"platform":"all"}
cnode-0 (out): Headers :{"User-Agent":"JPush-API-NodeJS-Client","Connection":"Keep-Alive","Charset":"UTF-8","Content-Type":"application/json"}
cnode-0 (out): Method :POST
cnode-0 (out): Times/MaxTryTimes : 1/3
cnode-0 (out): Push Fail, HttpStatusCode: 400 result: {"msg_id": 399888137, "error": {"message": "cannot find user by this audience", "code": 1011}}
cnode-0 (out): Push URL :https://api.jpush.cn/v3/push
cnode-0 (out): Body :{"options":{"sendno":848321656,"apns_production":true},"notification":{"android":{"alert":"alsotang 回复了你的主题","extras":{"topicId":"54d5c9dbeef4ca19212633ad"}},"ios":{"alert":"alsotang 回复了你的主题","sound":"","badge":4,"extras":{"topicId":"54d5c9dbeef4ca19212633ad"}},"alert":"alsotang 回复了你的主题"},"audience":{"alias":["54009f5ccd66f2eb37190485"]},"platform":"all"}
cnode-0 (out): Headers :{"User-Agent":"JPush-API-NodeJS-Client","Connection":"Keep-Alive","Charset":"UTF-8","Content-Type":"application/json"}
cnode-0 (out): Method :POST
cnode-0 (out): Times/MaxTryTimes : 1/3
cnode-0 (out): Push Fail, HttpStatusCode: 400 result: {"msg_id": 1670938158, "error": {"message": "cannot find user by this audience", "code": 1011}}
打印的日志中。
关键信息应该是这个:
Push Fail, HttpStatusCode: 400 result: {"msg_id": 1670938158, "error": {"message": "cannot find user by this audience", "code": 1011}}
有的 其实1.2.1我对老用户有自动注册,但漏掉了注册失败的情况。(jpush官方插件太烂 ,成功失败的callback都没有) 我现在改成每次启动都自动注册一遍
另外,现在jpush后台可以做到:
还有个疑问,如果用户只用 cnode 的网页版,但是不装 app 的话。是不是说,我这里就会收到很多类似的
"message": "cannot find user by this audience"
报错?
报错是所有的回复和@都会根据user._id请求jpush 如果这个user注册过jpush就会收到通知,没注册过就会返回上面的错误。 也就是cnode并不知道这个用户是否是注册过jpush的app用户。
这个之前考虑过,可以记录哪些用户是注册过jpush的app用户。但是我觉得无所谓,cnode无需管理哪些用户时有效的push用户哪些不是。
lib/JPush/JPush.js
107: console.log("Push Fail, HttpStatusCode: " + res.statusCode + " result: " + body.toString());
lib/JPush/JPushError.js
19: var message = "Push Fail, HttpStatusCode: " + httpCode + " result: " + response.toString();
果然是 jpush 自己打印出来的,服了
卧槽,jpush 里面一大堆的 console.log 无法关掉。。。服了。。不管了
呃。。。好吧。我怀疑这个错误不是我们 cnode 打印出来的,而是 jpush 里面打印出来的。那就让它打好了。
在 2015年2月7日,17:52,Lance Li <notifications@github.com mailto:notifications@github.com> 写道:
报错是所有的回复和@都会根据user._id请求jpush 如果这个user注册过jpush就会收到通知,没注册过就会返回上面的错误。 也就是cnode并不知道这个用户是否是注册过jpush的app用户。
— Reply to this email directly or view it on GitHub https://github.com/lanceli/cnodejs-ionic/issues/10#issuecomment-73357729.
哈哈 话说国内第三方推送服务还就jpush有phonegap插件 百度腾讯的都没有
jpush这个我自己还改了不少
你还改了?有合并到他们的 master 吗
在 2015年2月7日,18:07,Lance Li <notifications@github.com mailto:notifications@github.com> 写道:
jpush这个我自己还改了不少
— Reply to this email directly or view it on GitHub https://github.com/lanceli/cnodejs-ionic/issues/10#issuecomment-73358153.
改的是phonegap插件 还没提交pr
恩 看jpush后台你设备没注册上 你退出下 再登陆