asmack - 无法读取电子名片 [英] asmack - can't read VCard

查看:603
本文介绍了asmack - 无法读取电子名片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有确切的答案有什么建议( Asmack没有加载电子名片),但它仍然没有按'T的工作。调试输出显示拍击接收到电子名片信息包,但随后在<一抛出一个ClassCastException href=\"https://github.com/rtreffer/smack/blob/master/source/org/jivesoftware/smackx/packet/VCard.java#L548\" rel=\"nofollow\">https://github.com/rtreffer/smack/blob/master/source/org/jivesoftware/smackx/packet/VCard.java#L548而我得到的是XXX的XXX @无电子名片。

I did exactly what the answer suggested ( Asmack not loading VCard ) but it still doesn't work. The DEBUG output shows that Smack receives the packet with the VCard information but then throws a ClassCastException in https://github.com/rtreffer/smack/blob/master/source/org/jivesoftware/smackx/packet/VCard.java#L548 and all I get is 'No VCard for xxx@xxx'.

我的code:

public VCard getUserVCard() throws XMPPException {
    VCard userVCard = new VCard();
    userVCard.load(connection);
    return userVCard;
}

和一些previous初始化:

And some previous initialization:

ConnectionConfiguration config = new ConnectionConfiguration(OF_HOST, OF_PORT, OF_SERVICE_NAME);
config.setDebuggerEnabled(true);
    config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
ProviderManager.getInstance().addIQProvider("vCard ", "vcard-temp", new org.jivesoftware.smackx.provider.VCardProvider());
connection = new XMPPConnection(config);
this.context = context;
try {
    connection.connect();
} catch (XMPPException e) {
    // TODO Auto-generated catch block
        e.printStackTrace();
}

在数据库中的电子名片信息是确定 - 只有最终铸造失败。有什么建议?

The VCard information in the database is OK - only the final casting fails. Any suggestions?

推荐答案

我终于决定不仅添加VCardProvider但整个九码在配置下面这个帖子<一个href=\"http://stackoverflow.com/questions/5910219/problem-using-usersearch-in-xmpp-with-asmack\">Problem在XMPP使用UserSearch与ASmack 和它的工作。

I finally decided not only to add the VCardProvider but the whole nine yards in the configuration following this post Problem using UserSearch in XMPP with ASmack and it worked.

这篇关于asmack - 无法读取电子名片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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