سؤال

I am trying to send message from simulator to device. On simulator there is one user while on device there is another user. But presence is not being received at any end. I am using XMPPFramework for ios. Here is the code I am using to send presence

NSXMLElement *presence = [NSXMLElement elementWithName:@"presence"];
[presence addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"user1@server.com"]];
[presence addAttributeWithName:@"type" stringValue:@"available"];
[[self xmppStream] sendElement:presence]; 

But at the end where user1@server.com is logged in following method is NOT being invoked

- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
{
    NSLog(@"---------- xmppStream:didReceivePresence: ----------");
}

What might be the issue?

هل كانت مفيدة؟

المحلول

The reason presence was not being sent is that code was incorrect. I used following code to send presence

XMPPPresence *presence = [XMPPPresence presence];
    [[self xmppStream] sendElement:presence]; 

after that it showed user online on openfire server and message was correctly being sent to other users.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top