麻烦帮你看下,在极光网站生成环境能收到通知,C# 推送收不到


(小刀) #1
string APP_KEY = "04bd460f6bdd561d26c7d660",MASTER_SECRET = "bb8527fe23c1a8190c1bba88";
JPushClient pushClient = new JPushClient(APP_KEY, MASTER_SECRET);
PushPayload pushPayLoad = new PushPayload();
pushPayLoad.platform = Platform.all();
pushPayLoad.audience = Audience.s_alias("huangcl");
pushPayLoad.notification = Notification.android("测试数据", "测试");
pushPayLoad.message = cn.jpush.api.push.mode.Message.content("正在做测试");

pushClient.SendPush(pushPayLoad);

#2

收不到消息的问题:请提供推送的消息的msgid(MessageID)和收不到这条消息的设备的registrationID(在客户端获取,无论以何种方式做推送,该信息必须提供)
信息如何获取: 极光产品相关提问简要说明


(小刀) #3

发送返回:{sendno:0,message_id:24769798216731983}
registrationID 没找到,只能通过客户端日志查看吗?


#4

客户端调用API获取registrationID

服务端API推送消息给iOS,需要指定推送的环境!请让后台修改apns_production,false是开发,true是生产。关于测试生产环境的说明: 常见问题 - JPush 合集(持续更新)
如果修改没有用,检查自己的代码,是否有覆盖、引用等影响


(小刀) #5

我看了下,应该是发送到ios开发环境了,怎么设置正式环境呢?推送平台:ios-dev


#6

我上面不是给文档了吗???
对应在SDK里面找字段呀
https://github.com/jpush/jpush-api-csharp-client/blob/master/cn.jpush.api.example/JPushApiExample.cs#L397


(小刀) #7

不对呢?我修改了还是在测试环境呢?
public static PushPayload PushObject_apns_production_options()
{

        var pushPayload = new PushPayload();
        pushPayload.platform = Platform.android_ios();
        pushPayload.audience = Audience.s_tag("tag1", "tag2");
        pushPayload.message = Message.content(MSG_CONTENT).AddExtras("from", "JPush");
        pushPayload.options.apns_production = true;
        return pushPayload;

    }

Message ID 24769798217040079
推送平台 ios-dev
推送结果 已发送
audience {“alias”:[“cheny”,“huangcl”]}
notification {“ios”:{“sound”:"",“badge”:"+1",“alert”:“测试数据5”},“alert”:“测试数据5”}
message {“msg_content”:“正在做测试5”}
options {“time_to_live”:“86400”,“apns_production”:false


#8


#9

你代码写的是推送给tag里面改的,实际推送出去是推送给别名的,,,,在你推送的代码里面改OK?


(小刀) #10

可以了,谢谢,PushPayload pushPayLoad = JPushApiExample.PushObject_apns_production_options();
初始化这个地方开始错了.开始设置为pushPayload.options.apns_production = ture没有启用.


(小刀) #11

有没有设置url的文档呢?我没有找到,谢谢了


#12

这个什么意思?你要传URL给客户端吗?可以用extras传
https://github.com/jpush/jpush-api-csharp-client/blob/master/cn.jpush.api.example/JPushApiExample.cs#L372