Quickblox无法发送消息聊天

德克拉·扎伊德(Dhekra Zaied)

我将github中的示例代码用于ios sdk,并添加了我的帐户详细信息,但是当我在chatviewcontroller中发送消息时,得到了以下日志:

-[QBChat sendMessage:]->返回。您必须先登录才能使用Chat API我尝试了很多解决方案,但均未成功,我的代码创建了会话:

-(void)goToProfile{

    QBASessionCreationRequest *extendedAuthRequest = [QBASessionCreationRequest request];
    extendedAuthRequest.userLogin =email.text;
    extendedAuthRequest.userPassword =motDePasse.text;

    [QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self ];

}

之后在completedWithResult:(Result *)结果上下文:(void *)contextInfo中:

// QuickBlox API queries delegate
-(void)completedWithResult:(Result *)result  context:(void *)contextInfo{
    NSLog(@"errors=%@", result.errors);
    // QuickBlox User authentication result
    if([result isKindOfClass:[QBUUserLogInResult class]]){

        // Success result
        if(result.success){

            QBUUserLogInResult *res = (QBUUserLogInResult *)result;
            NSLog(@"------------Logged In user=%@", res);
            // Read about Chat password there http://quickblox.com/developers/Chat#Password
            //
            if([((__bridge NSString *)contextInfo) isEqualToString:socialLoginContext]){
                res.user.password = [QBBaseModule sharedModule].token;
            }else{
                res.user.password = motDePasse.text;
            }
            // Save current user
            //
            [[LocalStorageService shared] setCurrentUser: res.user];


            // Login to QuickBlox Chat
            //
            [[ChatService instance] loginWithUser:[LocalStorageService shared].currentUser completionBlock:^{
                 NSLog(@"------------local sotrage Logged In user=%@", [LocalStorageService shared].currentUser);
                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"You have successfully logged in"
                                                                message:nil
                                                               delegate:nil
                                                      cancelButtonTitle:@"Ok"
                                                      otherButtonTitles: nil];
                [alert show];
                //
                // hide alert after delay
                double delayInSeconds = 2.0;
                dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
                dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
                    [alert dismissWithClickedButtonIndex:0 animated:YES];
                });


            }];

            [[UserChoice sharedUserChoice]setIsConnectedUser:1];
            MySlideViewController *slideViewController = [[MySlideViewController alloc] initWithNibName:@"SlideViewController" bundle:nil];
            slideViewController.myDataUser = resultG;
            slideViewController.delegate = slideViewController;
            [[UserChoice sharedUserChoice] setMyUserProfile:resultG];
            slideViewController.myDataUserIn = [[UserChoice sharedUserChoice]myUserProfile];
            slideViewController.paramGeolocalisation = paramGeo;
            [self.navigationController pushViewController:slideViewController animated:YES];
            self.navigationController.navigationBarHidden = YES;
            // Errors
        }else{
            NSString *errorMessage = [[result.errors description] stringByReplacingOccurrencesOfString:@"(" withString:@""];
            errorMessage = [errorMessage stringByReplacingOccurrencesOfString:@")" withString:@""];

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Errors"
                                                            message:errorMessage
                                                           delegate:nil
                                                  cancelButtonTitle:@"Ok"
                                                  otherButtonTitles: nil];
            [alert show];

        }
    }

}
Rubycon

看起来您应该以这种方式更新代码:

// Login to QuickBlox Chat
[[ChatService instance] loginWithUser:[LocalStorageService shared].currentUser completionBlock:^{
    NSLog(@"------------local sotrage Logged In user=%@", [LocalStorageService shared].currentUser);
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"You have successfully logged in"
                                                                message:nil
                                                               delegate:nil
                                                      cancelButtonTitle:@"Ok"
                                                      otherButtonTitles: nil];
    [alert show];
    //
    // hide alert after delay
    double delayInSeconds = 2.0;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        [alert dismissWithClickedButtonIndex:0 animated:YES];
    });



    [[UserChoice sharedUserChoice]setIsConnectedUser:1];
    MySlideViewController *slideViewController = [[MySlideViewController alloc] initWithNibName:@"SlideViewController" bundle:nil];
    slideViewController.myDataUser = resultG;
    slideViewController.delegate = slideViewController;
    [[UserChoice sharedUserChoice] setMyUserProfile:resultG];
    slideViewController.myDataUserIn = [[UserChoice sharedUserChoice]myUserProfile];
    slideViewController.paramGeolocalisation = paramGeo;
    [self.navigationController pushViewController:slideViewController animated:YES];
    self.navigationController.navigationBarHidden = YES;

}];

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

无法使用QuickBlox Javascript SDK发送聊天消息

来自分类Dev

点对点聊天无法接收/发送消息

来自分类Dev

Quickblox聊天消息读取状态

来自分类Dev

Quickblox聊天消息读取状态

来自分类Dev

使用quickblox发送消息

来自分类Dev

发送聊天消息

来自分类Dev

QuickBlox聊天消息侦听器

来自分类Dev

Quickblox连续发送推送消息

来自分类Dev

TwitchIO:如何发送聊天消息?

来自分类Dev

Quickblox android API是否免费提供聊天消息?

来自分类Dev

检索存储在自定义表quickblox中的聊天消息

来自分类Dev

Quickblox没有发送xmppStream消息

来自分类Dev

从SSIS发送Microsoft Teams聊天消息的方法

来自分类Dev

如何捕获在聊天中发送消息的用户

来自分类Dev

linphone在聊天室中使用SIP消息发送消息

来自分类Dev

QuickBlox聊天未登录

来自分类Dev

iOS:无法获取XMPP聊天的脱机消息

来自分类Dev

Android quickblox如果用户不在聊天室中如何接收消息

来自分类Dev

如何使用Quickblox(在ChatView外部)在应用程序中捕获新的聊天消息?

来自分类Dev

Quickblox:“无收件人”错误。尝试将推送通知消息添加到简单聊天

来自分类Dev

Quickblox:“无收件人”错误。尝试将推送通知消息添加到“简单聊天”

来自分类Dev

在Quickblox中以编程方式删除一对一聊天记录消息吗?

来自分类Dev

允许发送消息的聊天网络应用

来自分类Dev

MySQL获取团队聊天,按上次消息发送时间排序

来自分类Dev

无需聊天即可发送和接收消息

来自分类Dev

套接字聊天应用程序在发送消息时冻结

来自分类Dev

Facebook-发送聊天消息和/或邀请以访问外部页面

来自分类Dev

从 Botframework 向 Azure 测试网络聊天发送消息

来自分类Dev

电报机器人向聊天错误发送消息:找不到聊天

Related 相关文章

  1. 1

    无法使用QuickBlox Javascript SDK发送聊天消息

  2. 2

    点对点聊天无法接收/发送消息

  3. 3

    Quickblox聊天消息读取状态

  4. 4

    Quickblox聊天消息读取状态

  5. 5

    使用quickblox发送消息

  6. 6

    发送聊天消息

  7. 7

    QuickBlox聊天消息侦听器

  8. 8

    Quickblox连续发送推送消息

  9. 9

    TwitchIO:如何发送聊天消息?

  10. 10

    Quickblox android API是否免费提供聊天消息?

  11. 11

    检索存储在自定义表quickblox中的聊天消息

  12. 12

    Quickblox没有发送xmppStream消息

  13. 13

    从SSIS发送Microsoft Teams聊天消息的方法

  14. 14

    如何捕获在聊天中发送消息的用户

  15. 15

    linphone在聊天室中使用SIP消息发送消息

  16. 16

    QuickBlox聊天未登录

  17. 17

    iOS:无法获取XMPP聊天的脱机消息

  18. 18

    Android quickblox如果用户不在聊天室中如何接收消息

  19. 19

    如何使用Quickblox(在ChatView外部)在应用程序中捕获新的聊天消息?

  20. 20

    Quickblox:“无收件人”错误。尝试将推送通知消息添加到简单聊天

  21. 21

    Quickblox:“无收件人”错误。尝试将推送通知消息添加到“简单聊天”

  22. 22

    在Quickblox中以编程方式删除一对一聊天记录消息吗?

  23. 23

    允许发送消息的聊天网络应用

  24. 24

    MySQL获取团队聊天,按上次消息发送时间排序

  25. 25

    无需聊天即可发送和接收消息

  26. 26

    套接字聊天应用程序在发送消息时冻结

  27. 27

    Facebook-发送聊天消息和/或邀请以访问外部页面

  28. 28

    从 Botframework 向 Azure 测试网络聊天发送消息

  29. 29

    电报机器人向聊天错误发送消息:找不到聊天

热门标签

归档