iphone - XMPP框架: can I determine the online/offline status of a user at all?

标签 iphone objective-c cocoa-touch xmpp xmppframework

如何使用 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];

您的流委托(delegate)获得的回调应该是

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

我假设您已经拥有 xmmpframework 源代码,如果没有,您可以在此处克隆存储库

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

示例项目位于“Xcode”文件夹中。

关于iphone - XMPP框架: can I determine the online/offline status of a user at all?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4960037/

相关文章:

ios - 如何使用 iCarousel 淡出 currentItem 之前的所有项目?

iphone - 在 iPhone SDK 中使用字符串和变量

objective-c - 从后台重新启动应用程序后 iAds 加载受限(也发生在 iAdSuite 中)

ios - Xcode 错误 : calling -display has no effect

iphone - 点击手势识别器不适用于 UIView 内部的 UIScrollView 中的 UIWebiew

iphone - iOS SDK中使用FourSquare API查找附近地点

iphone - 核心数据 : "Dangling reference to an invalid object." error

iphone - UIBarButton item 两种方法/IBAction

iphone - 增加 NSMutableArray 中的间隔间隙

ios - 如何在不调用 alloc 的情况下分配内存 - NSArray、NSString