JPush使用时问题注意

1集成JPush后,能收到通知,但是收不到自定义消息。

解决方案:

AppDelegate中加入如下代码:

//JPush推送

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkDidReceiveMessage:) name:kJPFNetworkDidReceiveMessageNotification object:nil];

并实现方法:

- (void)networkDidReceiveMessage:(NSNotification *)notification {

    NSDictionary * userInfo = [notification userInfo];

    NSLog(@"userInfo:%@",userInfo);

}

在测试就能收到网站上发送的自定义消息了。

2能收到网站收到的自定义消息,但是收不到后台服务器发送的自定义消息(后台往指定id发送的)

解决问题,设置别名

[APService setTags:nil  alias:[YRAccountTool account].ID  callbackSelector:nil  target:self];

 将用户的id设置为别名(按后台需求),就能正常收到自定义消息了

 

文章来自:http://www.cnblogs.com/guatiantian/p/4286797.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3