Set the app badge count
Synchronize the app's current unread count with the OpenIMClientSDK push badge state.
Use setAppBadge:onSuccess:onFailure: to report the total unread message count currently shown by the app to the SDK.
[[OIMManager manager] setAppBadge:totalUnreadCount
onSuccess:^(NSString * _Nullable data) {
// The SDK accepted the badge count.
}
onFailure:^(NSInteger code, NSString * _Nullable msg) {
// Handle the error as needed.
}];totalUnreadCount should be a non-negative integer. Update it when the total unread count changes, after login synchronization, or after clearing unread messages. Do not use the unread count of a single conversation as the app-wide badge count.
The success callback only means that the SDK accepted the badge value; it does not change the local unread count of any conversation. If the app displays a badge on its Home Screen icon, update the system UI through the appropriate iOS notification and badge APIs as well. See Retrieve and maintain the total unread count for querying and tracking the count.
Was this page helpful?