重新连接quickblox服务器后发送消息时遇到问题。用户在与其他人聊天的过程中自动注销,再次与服务器重新连接后,聊天消息不会发送。但是日志显示它已发送,未显示接收日志。重新连接代码工作正常但无法再聊天。
当它工作正常时,
2013-10-12 10:48:37.033 football365[1000:8517] -[QBChat xmppStream:didSendMessage:] -> Message: <message to="4099_000000001000000003@muc.chat.quickblox.com" id="7" type="groupchat"><body>hello</body></message>
2013-10-12 10:48:37.463 football365[1000:8517] -[QBChat xmppRoom:didReceiveMessage:fromNick:] -> message: <message xmlns="jabber:client" type="groupchat" to="578338-4099@chat.quickblox.com/tigase-11258" from="4099_000000001000000003@muc.chat.quickblox.com/578338"><body>hello</body></message> fromNick: 578338
仅发送消息时,不显示收到的日志。
2013-10-12 10:48:37.033 football365[1000:8517] -[QBChat xmppStream:didSendMessage:] -> Message: <message to="4099_000000001000000003@muc.chat.quickblox.com" id="7" type="groupchat"><body>hello</body></message>
DataManager.m中的登录代码。
- (void)chatLogin{
QBASessionCreationRequest *extendedAuthRequest = [QBASessionCreationRequest request];
extendedAuthRequest.userLogin = @"userid";
extendedAuthRequest.userPassword = @"password";
[QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}
- (void)completedWithResult:(Result *)result{
if(result.success && [result isKindOfClass:QBAAuthSessionCreationResult.class]){
QBAAuthSessionCreationResult *res = (QBAAuthSessionCreationResult *)result;
currentUser = [QBUUser user];
currentUser.ID = res.session.userID;
currentUser.password = @"password";
[[DataManager shared] setCurrentUser: currentUser];
[QBChat instance].delegate = self;
[[QBChat instance] loginWithUser:currentUser];
}
}
重新连接chatViewController.m中的代码,
-(void)chatDidFailWithError:(int)code
{
[[QBChat instance] loginWithUser:currentUser];
}