ZIM 升级指南
本文介绍 ZIM SDK for macOS 版本升级时的一些说明和注意事项。
2.18.0 升级指南
注意
从 2.18.0 版本开始,以下接口有重大变更,因此在从旧版本升级到 2.18.0 版本时,请您阅读以下指南。
单聊消息接收回调
原单聊消息接收回调 receivePeerMessage
已被废弃,请使用 peerMessageReceived 代替。
新回调支持以下功能:
- 用户在线时,可通过此回调接收在线单聊消息。
- 用户重新登录 ZIM SDK 后,可以通过此回调接收离线期间(最长7天)收到的所有单聊消息。
Untitled
// 新接口
- (void)zim:(ZIM *)zim
peerMessageReceived:(NSArray<ZIMMessage * > *)messageList
info:(ZIMMessageReceivedInfo *)info
fromUserID:(NSString *)fromUserID;
// 老接口
- (void)zim:(ZIM *)zim
receivePeerMessage:(NSArray<ZIMMessage * > *)messageList
fromUserID:(NSString *)fromUserID;
1
房间消息接收回调
原房间消息接收回调 receiveRoomMessage
已被废弃,请使用 roomMessageReceived 代替。
新回调支持以下功能:
- 用户在线时,可通过此回调接收在线房间消息。
- 用户从离线恢复到在线后,若仍在房间中,即可通过此回调接收离线期间内的所有房间消息。
Untitled
//新接口
- (void)zim:(ZIM *)zim
roomMessageReceived:(NSArray<ZIMMessage *> *)messageList
info:(ZIMMessageReceivedInfo *)info
fromRoomID:(NSString *)fromRoomID;
//老接口
- (void)zim:(ZIM *)zim
receiveRoomMessage:(NSArray<ZIMMessage *> *)messageList
fromRoomID:(NSString *)fromRoomID;
1
群组消息接收回调
原群组消息接收回调 receiveGroupMessage
已被废弃,请使用 groupMessageReceived 代替。
新回调支持以下功能:
- 用户在线时,可通过此回调接收在线群组消息。
- 用户重新登录 ZIM SDK 后,可以通过通过此回调接收离线期间(最长7天)收到的所有群聊消息。
Untitled
//新接口
- (void)zim:(ZIM *)zim
groupMessageReceived:(NSArray<ZIMMessage *> *)messageList
info:(ZIMMessageReceivedInfo *)info
fromGroupID:(NSString *)fromGroupID;
//老接口
- (void)zim:(ZIM *)zim
receiveGroupMessage:(NSArray<ZIMMessage *> *)messageList
fromGroupID:(NSString *)fromGroupID;
1
2.16.0 升级指南
注意
从 2.16.0 版本开始,以下接口有重大变更,因此在从旧版本升级到 2.16.0 版本时,请您阅读以下指南。
callCancel
说明
以下变更仅对进阶模式呼叫邀请而言。
在新版本的 callCancelWithInvitees 中,如果参数 userIDs 包含一个 userID,则该接口将仅取消邀请该被叫用户。如果 userIDs 参数为空,则该接口将对所有被叫用户取消邀请。
而对于旧版本的 callCancelWithInvitees
接口,无论参数 userIDs 是否为空,均视为对所有被叫用户取消邀请。
由于旧版 ZIM SDK 不兼容单独取消逻辑,因此如果您既需要保留使用老版本 ZIM 实现的取消逻辑,又需要使用新版本的单独取消功能,请隔离新老版本 ZIM 之间的呼叫功能。
2.16.0版本用法
旧版本用法
ZIMCallCancelConfig *cancelConfig = [[ZIMCallCancelConfig alloc] init];
// 单独取消 userIdA 、userIdB
[[ZIM getInstance] callCancelWithInvitees:@[@"userIdA",@"userIdB"] callID:@"callId" config:cancelConfig callback:^(NSString * _Nonnull callID, NSArray<NSString *> * _Nonnull errorInvitees, ZIMError * _Nonnull errorInfo) {
}];
// 取消整个呼叫邀请,当整个呼叫中所有被叫都未接受时可以调用成功
[[ZIM getInstance] callCancelWithInvitees:@[] callID:@"callId" config:cancelConfig callback:^(NSString * _Nonnull callID, NSArray<NSString *> * _Nonnull errorInvitees, ZIMError * _Nonnull errorInfo) {
}];
1
ZIMCallCancelConfig *cancelConfig = [[ZIMCallCancelConfig alloc] init];
// 无论 userIDs 中是否传递 userID,均为取消整个呼叫,当整个呼叫中所有被叫都未接受时可以调用成功
[[ZIM getInstance] callCancelWithInvitees:@[@"userIdA",@"userIdB"] callID:@"callId" config:cancelConfig callback:^(NSString * _Nonnull callID, NSArray<NSString *> * _Nonnull errorInvitees, ZIMError * _Nonnull errorInfo) {
}];
// 取消整个呼叫邀请,当整个呼叫中所有被叫都未接受时可以调用成功
[[ZIM getInstance] callCancelWithInvitees:@[] callID:@"callId" config:cancelConfig callback:^(NSString * _Nonnull callID, NSArray<NSString *> * _Nonnull errorInvitees, ZIMError * _Nonnull errorInfo) {
}];
1
2.5.0 升级指南
注意
ZIM SDK 在 2.5.0 版本对 Swift 语言接口做了命名优化,因此在从旧版本升级到 2.5.0 版本时,请您阅读以下所列的新旧接口名称变更情况。
getInstance
Untitled
//老接口
open class func getInstance() -> ZIM
//新接口
open class func shared() -> ZIM?
1
create
Untitled
//老接口
open class func create(with config: ZIMAppConfig) -> ZIM
//新接口
open class func create(with config: ZIMAppConfig) -> ZIM?
1
setAdvancedConfigWithKey
Untitled
//老接口
open class func setAdvancedConfigWithKey(_ key: String, value: String)
//新接口
open class func setAdvancedConfig(key: String, value: String)
1
uploadLog
Untitled
//老接口
open func uploadLog(_ callback: @escaping ZIMLogUploadedCallback)
//新接口
open func uploadLog(with callback: @escaping ZIMLogUploadedCallback)
1
queryUsersInfo
Untitled
//老接口
open func queryUsersInfo(_ userIDs: [String], config: ZIMUsersInfoQueryConfig, callback: @escaping ZIMUsersInfoQueriedCallback)
//新接口
open func queryUsersInfo(by userIDs: [String], config: ZIMUsersInfoQueryConfig, callback: @escaping ZIMUsersInfoQueriedCallback)
1
deleteConversation
Untitled
//老接口
open func deleteConversation(_ conversationID: String, conversationType: ZIMConversationType, config: ZIMConversationDeleteConfig, callback: @escaping ZIMConversationDeletedCallback)
//新接口
open func deleteConversation(by conversationID: String, conversationType: ZIMConversationType, config: ZIMConversationDeleteConfig, callback: @escaping ZIMConversationDeletedCallback)
1
clearConversationUnreadMessageCount
Untitled
//老接口
open func clearConversationUnreadMessageCount(_ conversationID: String, conversationType: ZIMConversationType, callback: @escaping ZIMConversationUnreadMessageCountClearedCallback)
//新接口
open func clearConversationUnreadMessageCount(for conversationID: String, conversationType: ZIMConversationType, callback: @escaping ZIMConversationUnreadMessageCountClearedCallback)
1
send(发送普通消息)
Untitled
//老接口
open func send(_ message: ZIMMessage, toConversationID: String, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, notification: ZIMMessageSendNotification?, callback: @escaping ZIMMessageSentCallback)
//新接口
open func sendMessage(_ message: ZIMMessage, toConversationID: String, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, notification: ZIMMessageSendNotification?, callback: @escaping ZIMMessageSentCallback)
1
send(旧版发送富媒体消息接口,自 2.4.0 版本后已弃用)
Untitled
//老接口
@available(*, deprecated, message: "Deprecated since ZIM 2.4.0, please use another [sendMediaMessage] instead")
open func send(_ message: ZIMMediaMessage, toConversationID: String, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, progress: @escaping ZIMMediaUploadingProgress, callback: @escaping ZIMMessageSentCallback)
//新接口
@available(*, deprecated, message: "Deprecated since ZIM 2.4.0, please use another [sendMediaMessage] instead")
open func sendMediaMessage(_ message: ZIMMediaMessage, toConversationID: String, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, progress: @escaping ZIMMediaUploadingProgress, callback: @escaping ZIMMessageSentCallback)
1
send(新版发送富媒体消息接口,2.4.0 版本或以上版本可用)
Untitled
//老接口
open func send(_ message: ZIMMediaMessage, toConversationID: String, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, notification: ZIMMediaMessageSendNotification?, callback: @escaping ZIMMessageSentCallback)
//新接口
open func sendMediaMessage(_ message: ZIMMediaMessage, toConversationID: String, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, notification: ZIMMediaMessageSendNotification?, callback: @escaping ZIMMessageSentCallback)
1
queryHistoryMessage
Untitled
//老接口
open func queryHistoryMessage(byConversationID conversationID: String, conversationType: ZIMConversationType, config: ZIMMessageQueryConfig, callback: @escaping ZIMMessageQueriedCallback)
//新接口
open func queryHistoryMessage(by conversationID: String, conversationType: ZIMConversationType, config: ZIMMessageQueryConfig, callback: @escaping ZIMMessageQueriedCallback)
1
deleteAllMessage
Untitled
//老接口
open func deleteAllMessage(byConversationID conversationID: String, conversationType: ZIMConversationType, config: ZIMMessageDeleteConfig, callback: @escaping ZIMMessageDeletedCallback)
//新接口
open func deleteAllMessage(by conversationID: String, conversationType: ZIMConversationType, config: ZIMMessageDeleteConfig, callback: @escaping ZIMMessageDeletedCallback)
1
delete
Untitled
//老接口
open func delete(_ messageList: [ZIMMessage], conversationID: String, conversationType: ZIMConversationType, config: ZIMMessageDeleteConfig, callback: @escaping ZIMMessageDeletedCallback)
//新接口
open func deleteMessages(_ messageList: [ZIMMessage], conversationID: String, conversationType: ZIMConversationType, config: ZIMMessageDeleteConfig, callback: @escaping ZIMMessageDeletedCallback)
1
insertMessage
Untitled
//老接口
open func insertMessage(toLocalDB message: ZIMMessage, conversationID: String, conversationType: ZIMConversationType, senderUserID: String, callback: @escaping ZIMMessageInsertedCallback)
//新接口
open func insertMessageToLocalDB(_ message: ZIMMessage, conversationID: String, conversationType: ZIMConversationType, senderUserID: String, callback: @escaping ZIMMessageInsertedCallback)
1
createRoom(创建并加入一个房间)
Untitled
//老接口
open func createRoom(_ roomInfo: ZIMRoomInfo, callback: @escaping ZIMRoomCreatedCallback)
//新接口
open func createRoom(with roomInfo: ZIMRoomInfo, callback: @escaping ZIMRoomCreatedCallback)
1
createRoom(创建带高级设置的房间)
Untitled
//老接口
open func createRoom(_ roomInfo: ZIMRoomInfo, config: ZIMRoomAdvancedConfig, callback: @escaping ZIMRoomCreatedCallback)
//新接口
open func createRoom(with roomInfo: ZIMRoomInfo, config: ZIMRoomAdvancedConfig, callback: @escaping ZIMRoomCreatedCallback)
1
joinRoom
Untitled
//老接口
open func joinRoom(_ roomID: String, callback: @escaping ZIMRoomJoinedCallback)
//新接口
open func joinRoom(by roomID: String, callback: @escaping ZIMRoomJoinedCallback)
1
enterRoom
Untitled
//老接口
open func enterRoom(_ roomInfo: ZIMRoomInfo, config: ZIMRoomAdvancedConfig?, callback: @escaping ZIMRoomEnteredCallback)
//新接口
open func enterRoom(with roomInfo: ZIMRoomInfo, config: ZIMRoomAdvancedConfig?, callback: @escaping ZIMRoomEnteredCallback)
1
leaveRoom
Untitled
//老接口
open func leaveRoom(_ roomID: String, callback: @escaping ZIMRoomLeftCallback)
//新接口
open func leaveRoom(by roomID: String, callback: @escaping ZIMRoomLeftCallback)
1
queryRoomMemberList
Untitled
//老接口
open func queryRoomMemberList(byRoomID roomID: String, config: ZIMRoomMemberQueryConfig, callback: @escaping ZIMRoomMemberQueriedCallback)
//新接口
open func queryRoomMemberList(by roomID: String, config: ZIMRoomMemberQueryConfig, callback: @escaping ZIMRoomMemberQueriedCallback)
1
queryRoomOnlineMemberCount
Untitled
//老接口
open func queryRoomOnlineMemberCount(byRoomID roomID: String, callback: @escaping ZIMRoomOnlineMemberCountQueriedCallback)
//新接口
open func queryRoomOnlineMemberCount(by roomID: String, callback: @escaping ZIMRoomOnlineMemberCountQueriedCallback)
1
beginRoomAttributesBatchOperation
Untitled
//老接口
open func beginRoomAttributesBatchOperation(withRoomID roomID: String, config: ZIMRoomAttributesBatchOperationConfig?)
//新接口
open func beginRoomAttributesBatchOperation(with roomID: String, config: ZIMRoomAttributesBatchOperationConfig?)
1
endRoomAttributesBatchOperation
Untitled
//老接口
open func endRoomAttributesBatchOperation(withRoomID roomID: String, callback: @escaping ZIMRoomAttributesBatchOperatedCallback)
//新接口
open func endRoomAttributesBatchOperation(with roomID: String, callback: @escaping ZIMRoomAttributesBatchOperatedCallback)
1
queryRoomAllAttributes
Untitled
//老接口
open func queryRoomAllAttributes(byRoomID roomID: String, callback: @escaping ZIMRoomAttributesQueriedCallback)
//新接口
open func queryRoomAllAttributes(by roomID: String, callback: @escaping ZIMRoomAttributesQueriedCallback)
1
queryRoomMembersAttributes
Untitled
//老接口
open func queryRoomMembersAttributes(byUserIDs userIDs: [String], roomID: String, callback: @escaping ZIMRoomMembersAttributesQueriedCallback)
//新接口
open func queryRoomMembersAttributes(by userIDs: [String], roomID: String, callback: @escaping ZIMRoomMembersAttributesQueriedCallback)
1
queryRoomMemberAttributesList
Untitled
//老接口
open func queryRoomMemberAttributesList(byRoomID roomID: String, config: ZIMRoomMemberAttributesQueryConfig, callback: @escaping ZIMRoomMemberAttributesListQueriedCallback)
//新接口
open func queryRoomMemberAttributesList(by roomID: String, config: ZIMRoomMemberAttributesQueryConfig, callback: @escaping ZIMRoomMemberAttributesListQueriedCallback)
1
createGroup(创建并加入一个群组)
Untitled
//老接口
open func createGroup(_ groupInfo: ZIMGroupInfo, userIDs: [String], callback: @escaping ZIMGroupCreatedCallback)
//新接口
open func createGroup(with groupInfo: ZIMGroupInfo, userIDs: [String], callback: @escaping ZIMGroupCreatedCallback)
1
createGroup(创建并加入一个带群属性的群组)
Untitled
//老接口
open func createGroup(_ groupInfo: ZIMGroupInfo, userIDs: [String], config: ZIMGroupAdvancedConfig, callback: @escaping ZIMGroupCreatedCallback)
//新接口
open func createGroup(with groupInfo: ZIMGroupInfo, userIDs: [String], config: ZIMGroupAdvancedConfig, callback: @escaping ZIMGroupCreatedCallback)
1
dismissGroup
Untitled
//老接口
open func dismissGroup(_ groupID: String, callback: @escaping ZIMGroupDismissedCallback)
//新接口
open func dismissGroup(by groupID: String, callback: @escaping ZIMGroupDismissedCallback)
1
joinGroup
Untitled
//老接口
open func joinGroup(_ groupID: String, callback: @escaping ZIMGroupJoinedCallback)
//新接口
open func joinGroup(by groupID: String, callback: @escaping ZIMGroupJoinedCallback)
1
leaveGroup
Untitled
//老接口
open func leaveGroup(_ groupID: String, callback: @escaping ZIMGroupLeftCallback)
//新接口
open func leaveGroup(by groupID: String, callback: @escaping ZIMGroupLeftCallback)
1
inviteUsers
Untitled
//老接口
open func inviteUsers(intoGroup userIDs: [String], groupID: String, callback: @escaping ZIMGroupUsersInvitedCallback)
//新接口
open func inviteUsersIntoGroup(with userIDs: [String], groupID: String, callback: @escaping ZIMGroupUsersInvitedCallback)
1
kickGroupMembers
Untitled
//老接口
open func kickGroupMembers(_ userIDs: [String], groupID: String, callback: @escaping ZIMGroupMemberKickedCallback)
//新接口
open func kickGroupMembers(by userIDs: [String], groupID: String, callback: @escaping ZIMGroupMemberKickedCallback)
1
transferGroupOwner
Untitled
//老接口
open func transferGroupOwner(toUserID: String, groupID: String, callback: @escaping ZIMGroupOwnerTransferredCallback)
//新接口
open func transferGroupOwner(to toUserID: String, groupID: String, callback: @escaping ZIMGroupOwnerTransferredCallback)
1
queryGroupInfo
Untitled
//老接口
open func queryGroupInfo(byGroupID groupID: String, callback: @escaping ZIMGroupInfoQueriedCallback)
//新接口
open func queryGroupInfo(by groupID: String, callback: @escaping ZIMGroupInfoQueriedCallback)
1
deleteGroupAttributes
Untitled
//老接口
open func deleteGroupAttributes(byKeys keys: [String], groupID: String, callback: @escaping ZIMGroupAttributesOperatedCallback)
//新接口
open func deleteGroupAttributes(by keys: [String], groupID: String, callback: @escaping ZIMGroupAttributesOperatedCallback)
1
queryGroupAttributes
Untitled
//老接口
open func queryGroupAttributes(byKeys keys: [String], groupID: String, callback: @escaping ZIMGroupAttributesQueriedCallback)
//新接口
open func queryGroupAttributes(by keys: [String], groupID: String, callback: @escaping ZIMGroupAttributesQueriedCallback)
1
queryGroupAllAttributes
Untitled
//老接口
open func queryGroupAllAttributes(byGroupID groupID: String, callback: @escaping ZIMGroupAttributesQueriedCallback)
//新接口
open func queryGroupAllAttributes(by groupID: String, callback: @escaping ZIMGroupAttributesQueriedCallback)
1
queryGroupMemberInfo
Untitled
//老接口
open func queryGroupMemberInfo(byUserID userID: String, groupID: String, callback: @escaping ZIMGroupMemberInfoQueriedCallback)
//新接口
open func queryGroupMemberInfo(by userID: String, groupID: String, callback: @escaping ZIMGroupMemberInfoQueriedCallback)
1
queryGroupMemberList
Untitled
//老接口
open func queryGroupMemberList(byGroupID groupID: String, config: ZIMGroupMemberQueryConfig, callback: @escaping ZIMGroupMemberListQueriedCallback)
//新接口
open func queryGroupMemberList(by groupID: String, config: ZIMGroupMemberQueryConfig, callback: @escaping ZIMGroupMemberListQueriedCallback)
1
queryGroupMemberCount
Untitled
//老接口
open func queryGroupMemberCount(byGroupID groupID: String, callback: @escaping ZIMGroupMemberCountQueriedCallback)
//新接口
open func queryGroupMemberCount(by groupID: String, callback: @escaping ZIMGroupMemberCountQueriedCallback)
1
callInvite
Untitled
//老接口
open func callInvite(withInvitees invitees: [String], config: ZIMCallInviteConfig, callback: @escaping ZIMCallInvitationSentCallback)
//新接口
open func callInvite(with invitees: [String], config: ZIMCallInviteConfig, callback: @escaping ZIMCallInvitationSentCallback)
1
callCancel
Untitled
//老接口
open func callCancel(withInvitees invitees: [String], callID: String, config: ZIMCallCancelConfig, callback: @escaping ZIMCallCancelSentCallback)
//新接口
open func callCancel(with invitees: [String], callID: String, config: ZIMCallCancelConfig, callback: @escaping ZIMCallCancelSentCallback)
1
callAccept
Untitled
//老接口
open func callAccept(withCallID callID: String, config: ZIMCallAcceptConfig, callback: @escaping ZIMCallAcceptanceSentCallback)
//新接口
open func callAccept(with callID: String, config: ZIMCallAcceptConfig, callback: @escaping ZIMCallAcceptanceSentCallback)
1
callReject
Untitled
//老接口
open func callReject(withCallID callID: String, config: ZIMCallRejectConfig, callback: @escaping ZIMCallRejectionSentCallback)
//新接口
open func callReject(with callID: String, config: ZIMCallRejectConfig, callback: @escaping ZIMCallRejectionSentCallback)
1