QuickBlox聊天未登录

达福斯

我正在研究swift和quickblox,并且试图在用户之间进行聊天。用户身份验证和登录正在正常运行,只是由于某种原因聊天未登录。有问题的代码:

                QBRequest.createSessionWithExtendedParameters(parameters, successBlock: { (response : QBResponse! ,session : QBASession!) -> Void in

                var currentUser = QBUUser()
                currentUser.ID = session.userID
                currentUser.password = userPassword as String
                QBChat().addDelegate(self)
                QBChat().loginWithUser(currentUser)



                let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
                appDelegate.initiateLocationServicesUpdates()

                self.boxView.removeFromSuperview()

                self.performSegueWithIdentifier("alreadySignedInSegue", sender: self)


                }, errorBlock: { (response : QBResponse!) -> Void in
                    self.boxView.removeFromSuperview()
                    NSLog("error: %@", response.error);
                    self.view.userInteractionEnabled = true
                    var alert : UIAlertController = UIAlertController()
                    let action : UIAlertAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil)
                    if let error = response.error.reasons{
                        if  response.error.reasons.description.rangeOfString("Unauthorized") != nil{
                            alert = UIAlertController(title: "Oops", message: "Wrong Username/Password Combination", preferredStyle: UIAlertControllerStyle.Alert)
                            alert.addAction(action)
                            self.presentViewController(alert, animated: true, completion: nil)
                        }
                    }
                    else{
                        alert = UIAlertController(title: "Oops", message: "Something Went Wrong, Its Our Fault!", preferredStyle: UIAlertControllerStyle.Alert)
                        alert.addAction(action)
                        self.presentViewController(alert, animated: true, completion: nil)
                    }
            })

成功块中找到的segue起作用,但是QBChat()。isLoggedIn()的值始终为false,如果我尝试通过

QBChat().sendMessage(message: QBChatMessage!)

功能我最终收到“必须登录才能聊天”消息。这一定是一个小问题,原因是我忽略了某些东西。

edit: 只是为了让您知道这是我第一次与quickblox合作,所以请准确了解我做错了什么

格勒布斯

您应该使用QBChat的共享实例进行聊天。

QBChat.instance().addDelegate(self)
QBChat.instance().loginWithUser(currentUser)

还要检查

setAutoCreateSessionEnabled

QBConnection中的方法。您可以忘记会话管理。

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

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

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

登录QuickBlox for Android应用中的聊天

来自分类Dev

聊天转换未显示在视图中 - QuickBlox iOS 设置

来自分类Dev

在没有登录名或密码的情况下在IOS中使用QuickBlox视频聊天

来自分类Dev

如何清除聊天服务器中的quickblox未读邮件计数?

来自分类Dev

Quickblox聊天消息读取状态

来自分类Dev

Quickblox Android SDK群组聊天

来自分类Dev

Quickblox无法发送消息聊天

来自分类Dev

Quickblox聊天消息读取状态

来自分类Dev

Quickblox聊天数据复制

来自分类Dev

在Quickblox中动态更新聊天

来自分类Dev

QuickBlox聊天消息侦听器

来自分类Dev

Quickblox聊天应用程序,Android

来自分类Dev

使用QuickBlox保存聊天记录

来自分类Dev

在iOS聊天中的QuickBlox QBUUser中设置聊天/头像

来自分类Dev

如何使用Quickblox聊天室进行1:1聊天?

来自分类Dev

无法在Android中登录QuickBlox

来自分类Dev

Quickblox VideoChat-未连接

来自分类Dev

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

来自分类Dev

Quickblox一对一聊天连接丢失

来自分类Dev

如何在Quickblox聊天中识别“正在输入...”?

来自分类Dev

用于Web的quickblox-创建1对1聊天

来自分类Dev

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

来自分类Dev

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

来自分类Dev

每个对象在Quickblox Android私人聊天中的功能是什么?

来自分类Dev

如何在Swift的QuickBlox聊天中添加朋友

来自分类Dev

QuickBlox:注销后已登录错误

来自分类Dev

断开连接后quickblox自动重新登录

来自分类Dev

QuickBlox:注销后已登录错误

来自分类Dev

使用Facebook自己的SDK登录QuickBlox?