open-im-ios-demo
open-im-ios-demo copied to clipboard
Bug: <If all Subjects are subscribed before onConnectSuccess, they will not be able to obtain the latest status after connecting>
What happened?
BehaviorSubject 如果在onConnectSuccess之前订阅,不会连接后无法获取最新状态 毕竟用的IMController, 基础所有的状态和通知都用的BehaviorSubject 比如我在tabbar订阅了totalUnreadSubject理论应该直接可以拿到最新的值 现在在需要 1.IMController.shared.getTotalUnreadMsgCount 2.IMController.shared.totalUnreadSubject
What did you expect to happen?
并且在每次重练后也要做这2件事情 建议,totalUnreadSubject 默认获取并推送最新值
How can we reproduce it (as minimally and precisely as possible)?
并且在每次重练后也要做这2件事情 建议,totalUnreadSubject 默认获取并推送最新值
Anything else we need to know?
No response
version
Cloud provider
OS version
Install tools
// MARK: - 会话方法
public extension IMController { func getConversation(sessionType: ConversationType = .undefine, sourceId: String = "", conversationID: String = "", onSuccess: @escaping CallBack.ConversationInfoOptionalReturnVoid) { if !conversationID.isEmpty { Self.shared.imManager.getMultipleConversation([conversationID]) { conversations in onSuccess(conversations?.first?.toConversationInfo()) } onFailure: { code, msg in print("创建会话失败:(code), .msg:(msg ?? "")") }
} else {
let conversationType = OIMConversationType(rawValue: sessionType.rawValue) ?? OIMConversationType.undefine
Self.shared.imManager.getOneConversation(withSessionType: conversationType, sourceID: sourceId) { (conversation: OIMConversationInfo?) in
onSuccess(conversation?.toConversationInfo())
} onFailure: { code, msg in
print("创建会话失败:\(code), .msg:\(msg ?? "")")
}
}
}
怎么还吞失败回调呀
// MARK: - 会话方法
public extension IMController { func getConversation(sessionType: ConversationType = .undefine, sourceId: String = "", conversationID: String = "", onSuccess: @escaping CallBack.ConversationInfoOptionalReturnVoid) { if !conversationID.isEmpty { Self.shared.imManager.getMultipleConversation([conversationID]) { conversations in onSuccess(conversations?.first?.toConversationInfo()) } onFailure: { code, msg in print("创建会话失败:(code), .msg:(msg ?? "")") }
} else { let conversationType = OIMConversationType(rawValue: sessionType.rawValue) ?? OIMConversationType.undefine Self.shared.imManager.getOneConversation(withSessionType: conversationType, sourceID: sourceId) { (conversation: OIMConversationInfo?) in onSuccess(conversation?.toConversationInfo()) } onFailure: { code, msg in print("创建会话失败:\(code), .msg:\(msg ?? "")") } } }怎么还吞失败回调呀
https://github.com/openimsdk/open-im-ios-demo/blame/e67914551140e35a7aa24902b9184b2fd04b4635/OUICore/Classes/Core/IMController.swift#L995
@birdmichael Hi, can you pr the relevant code?