leancloud / ChatKit-OC

此项目已经废弃,以后不再维护。我们推出了基于 Swift SDK 的 Chat Demo。
https://github.com/leancloud/swift-sdk-demo
MIT License
2.12k stars 461 forks source link

切换账户重新登录进入对话controller会崩溃,设置invaildedHandler无效。 #335

Closed ramboli1986 closed 7 years ago

ramboli1986 commented 7 years ago

Base Info for this issue

实际是两个问题,

  1. 退出当前用户并用另外账户重新登录后,进入到conversation controller会crash在 - (void)notJoinedHandler:(AVIMConversation )conversation error:(NSError )aError 函数中的以下这句 [conversationInvalidedHandler(conversationId, self, user, error);]

  2. 设置了conversationInvalidedHandler, 但在崩溃出仍然显示handler为nil,设置没有起作用。

参考了example的代码, 以下是我的退出登录部分代码

            LCChatKit.sharedInstance().removeAllCachedProfiles()
            LCChatKit.sharedInstance().close(callback: { (success, error) in
                if success {
                      user.logout 
                }
}

以下是设置invalidHandler的代码 , LCChatKit.sharedInstance().conversationInvalidedHandler = { (conversationId, controller, administrator, error) in

        controller?.navigationController?.popViewController(animated: true)
        SVProgressHUD.showError(withStatus: "稍后重试")
        SVProgressHUD.dismiss(withDelay: 1)

    }

望指教,谢谢!

  1. ChatKit Version:0.10.1
  2. App-ID: XX
  3. Language:Swift
  4. iOS System Version:iOS10.2
  5. Prototype(是否是真机):YES
  6. Issue Type:Crash、Bug、Enhancement(希望能支持一个新需求)、Q-A

1. How to repeat the problem.

2. Please help me in this way.

3. Here is a Demo.

4. Here is my Debug log