2011-02-10 69 views

回答

6

您检查出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

相关问题