我完全按照答案的建议做了( Asmack not loading VCard ),但它仍然不能工作。调试输出显示Smack收到了包含VCard信息的数据包,但随后在https://github.com/rtreffer/smack/blob/master/source/org/jivesoftware/smackx/packet/VCard.java#L548中抛出了一个ClassCastException,我得到的结果是“No VCard for xxx@xxx”。
我的代码:
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信息是正常的-只有最终的转换失败。有什么建议吗?
发布于 2012-02-16 19:21:25
我最终决定在这篇getSearchForm returns null when using UserSearch in XMPP with aSmack之后的配置中不仅添加VCardProvider,而且添加整个9码,并且它起作用了。
https://stackoverflow.com/questions/9089917
复制相似问题