XMPPFramework:我可以确定用户的在线/离线状态吗?

问题描述:

如何使用XMPPFramework for iPhone确定用户是否在线/离线?XMPPFramework:我可以确定用户的在线/离线状态吗?

我有自己的JID等等等等是否有请求存在或某事的一种方式?

谢谢。

您检查出XMPPFramework示例项目的源代码?

如果我没有记错,这应该是相关的代码片段:

// Subscribe to the buddy's presence 
// 
// <presence to="bareJID" type="subscribe"/> 

NSXMLElement *presence = [NSXMLElement elementWithName:@"presence"]; 
[presence addAttributeWithName:@"to" stringValue:[jid bare]]; 
[presence addAttributeWithName:@"type" stringValue:@"subscribe"]; 

[xmppStream sendElement:presence]; 

和你流的代表得到的回调应该是

- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence; 

我假设你已经有xmmpframework源,如果没有,你可以在这里克隆库

hg clone https://xmppframework.googlecode.com/hg/ xmppframework 

样本pro项目位于“Xcode”文件夹中。

+0

这将基本上意味着你首先需要获得再名册使各个呼叫 – user281300 2012-01-28 10:19:22