xmppPubSub didReceiveMessage委托没有得到调用

时间:2017-11-21 09:09:39

标签: ios objective-c xmpp subscribe

//setupStream
XMPPJID *serviceJID =[XMPPJID jidWithString:[NSString stringWithFormat:@"pubsub.%@",SERVICE]];
    _xmppPubSub = [[XMPPPubSub alloc]initWithServiceJID:serviceJID     dispatchQueue:dispatch_get_main_queue()];
    [_xmppPubSub addDelegate:self delegateQueue:dispatch_get_main_queue()];
    [_xmppPubSub activate:xmppStream];

//subscribe
 NSString *node=[NSString stringWithFormat:@"pubsub_%@",[userDefault valueForKey:@"userJid"]] ;
[_xmppPubSub subscribeToNode:[node lowercaseString] withJID:xmppStream.myJID];

- (void)xmppPubSub:(XMPPPubSub *)sender didSubscribeToNode:(NSString *)node withResult:(XMPPIQ *)iq{
     NSLog(@"success!");
}

//this delegate not get call when published by server
-(void)xmppPubSub:(XMPPPubSub *)sender didReceiveMessage:(XMPPMessage *)message{
    NSLog(@"didReceiveMessage%@",message);
}

0 个答案:

没有答案