1

重新连接 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];
    }
4

0 回答 0