使用 ios xmpp 框架显示在线好友列表问题 [英] Show online buddy list issue using the ios xmpp Framework

查看:22
本文介绍了使用 ios xmpp 框架显示在线好友列表问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 XMPP 框架构建 iPhone 应用程序.我在下面的代码中有一个问题:

I am building an iPhone application using the XMPP Framework. I have an issue in the code bellow:

NSString *presenceType = [presence type]; // online/offline
    NSString *myUsername = [[sender myJID] user];
    NSString *presenceFromUser = [[presence from] user];
    if (![presenceFromUser isEqualToString:myUsername]) {
        if ([presenceType isEqualToString:@"available"]) {
            [self._chatDelegate newBuddyOnline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, @"server.net"]];
        } else if ([presenceType isEqualToString:@"unavailable"]) {
            [self._chatDelegate buddyWentOffline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, @"server.net"]];
        }
   }

假设我创建了 2 个 jabber 帐户,ichat@server.net 和 iPhone@server.net.当我使用 iPhone 帐户启动我的应用程序时,我看不到没有人连接.当我删除这一行时:

Suppose that i have created 2 jabber accounts, ichat@server.net and iPhone@server.net. When i launch my application with the iPhone account, i can't see no one is connected. when i remove this line:

if (![presenceFromUser isEqualToString:myUsername])

我可以看到两行带有 iphone@server.net(我的帐户)的在线好友表视图.在调试模式下,当我检查 PresenceFromUser 变量时,每次它都包含我的登录信息,而不是其他在线好友的登录信息.

i can see two rows with iphone@server.net (my account) one the online buddies table view. In Debug mode, when i checked the presenceFromUser variable, each time it's containing MY login not login for other buddies online.

你能帮我解决这个问题吗?提前致谢

Can you help me to fix this please. Thanks in advance

推荐答案

好的,我找到了导致这个问题的原因.确实,我在创建项目时错过了配置项目,更准确地说,我在配置 libxml 时出了点问题.现在,它可以使用相同的代码正常工作.

OK, I found out what was causing this problem. Indeed, i miss configured the project when creating it, to be more precise I have something wrong when i configured libxml. Right now, it working correctly with the same code.

PS:我认为 XMPP iOS Framework 还不稳定,所以我想我会改变应用程序内的聊天技术.

PS: I think that the XMPP iOS Framework is not still stable, so I think that I will change chat technology within the application.

这篇关于使用 ios xmpp 框架显示在线好友列表问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆