Tho*_*son 2 iphone cocoa-touch xmpp objective-c xmppframework
如何使用XMPPFramework for iPhone确定用户是否在线/离线?
我有他们的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];
Run Code Online (Sandbox Code Playgroud)
并且您的流委托得到的回调应该是
- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence;
Run Code Online (Sandbox Code Playgroud)
我假设您已经拥有xmmpframework源,如果没有,您可以在此处克隆存储库
hg clone https://xmppframework.googlecode.com/hg/ xmppframework
Run Code Online (Sandbox Code Playgroud)
示例项目位于"Xcode"文件夹中.
| 归档时间: |
|
| 查看次数: |
4821 次 |
| 最近记录: |