我在使用消息ID连接iOS和Android设备及其相应的QBChat库时遇到问题。在Quickblox中iOS和Android之间连接聊天的消息ID问题
Quickblox的iOS库中的消息对象被定义为QuickBlox的Android库(将它们委托给SMACK库中的Message类)中不存在的QBChatMessage对象。
问题是,QBChatMessage类管理消息ID的整数,而消息类管理他们作为字符串。从我的Android设备发送的每条消息都有一个7个字符的唯一字符串+一个包含消息在SMACK聊天中的位置的数字。当我的iPhone收到消息,它的ID是从咂了ID的数量分析为多,因为它可以,因为这种沟通样品(从Android设备拍摄)中:
SENT <message id="D64u5-4" to="[email protected]" from="[email protected]/Smack" type="chat"><body>{"content":{"text":"hello"},"type":1}</body><thread>7J9230</thread></message>
SENT <message id="D64u5-5" to="[email protected]" from="[email protected]/Smack" type="chat"><body>{"content":{"text":"yeah"},"type":1}</body><thread>7J9230</thread></message>
SENT <message id="D64u5-6" to="[email protected]" from="[email protected]/Smack" type="chat"><body>{"content":{"text":"test"},"type":1}</body><thread>7J9230</thread></message>
RCV <message id="0" from="[email protected]" type="chat" xmlns="jabber:client" to="[email protected]"><body>{"content":{"text":"hello"},"type":1}</body></message>
RCV <message id="1" from="[email protected]" type="chat" xmlns="jabber:client" to="[email protected]"><body>{"content":{"text":"yeah?"},"type":1}</body></message>
RCV <message id="2" from="[email protected]" type="chat" xmlns="jabber:client" to="[email protected]"><body>{"content":{"text":"yeah!"},"type":1}</body></message>
消息的ID对我很重要,按数据库存储的顺序。这怎么可能?我该怎么做才能解决这个问题?
谢谢,亲切的问候! :)
非常感谢!在我看来,将iOS中的id改为NSString将是最简单和最好的解决方案。然而,我自己通过在Android中管理自己的id并使用SMACK的Message类进行通信来设法解决这个问题,而不是使用String进行通信。 – dinoenri 2013-04-23 09:50:46