XMPPFramework - iOS 中未收到存在信息
我正在尝试将消息从模拟器发送到设备。在模拟器上有一个用户,而在设备上有另一个用户。但无论如何都没有收到存在感。 我正在使用适用于 ios 的 XMPPFramework。 这是我用来发送状态的代码
NSXMLElement *presence = [NSXMLElement elementWithName:@"presence"];
[presence addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"[email protected]"]];
[presence addAttributeWithName:@"type" stringValue:@"available"];
[[self xmppStream] sendElement:presence];
,但在最后 [email protected]
已登录,未调用以下方法
- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
{
NSLog(@"---------- xmppStream:didReceivePresence: ----------");
}
可能是什么问题?
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:@"[email protected]"]];
[presence addAttributeWithName:@"type" stringValue:@"available"];
[[self xmppStream] sendElement:presence];
But at the end where [email protected]
is logged in following method is NOT being invoked
- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
{
NSLog(@"---------- xmppStream:didReceivePresence: ----------");
}
What might be the issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
未发送存在的原因是代码不正确。我使用以下代码发送存在状态
,之后它显示用户在 openfire 服务器上在线,并且消息已正确发送给其他用户。
The reason presence was not being sent is that code was incorrect. I used following code to send presence
after that it showed user online on openfire server and message was correctly being sent to other users.