gpt4 book ai didi

java - asmack - 无法读取 VCard

转载 作者:行者123 更新时间:2023-12-01 05:30:12 35 4
gpt4 key购买 nike

我完全按照答案建议的操作( Asmack not loading VCard ),但它仍然不起作用。 DEBUG 输出显示 Smack 收到带有 VCard 信息的数据包,但随后在 https://github.com/rtreffer/smack/blob/master/source/org/jivesoftware/smackx/packet/VCard.java#L548 中抛出 ClassCastException我得到的只是“xxx@xxx 没有 VCard”。

我的代码:

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

以及之前的一些初始化:

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();
}

数据库中的 VCard 信息正常 - 只是最终转换失败。有什么建议吗?

最佳答案

我最终决定不仅添加 VCardProvider,而且在这篇文章之后的配置中添加整个九码 getSearchForm returns null when using UserSearch in XMPP with aSmack它起作用了。

关于java - asmack - 无法读取 VCard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9089917/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com