// 1. 设置监听- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// 监听推送[V2TIMManager.sharedInstance setAPNSListener:self];// 监听会话的未读数[[V2TIMManager sharedInstance] setConversationListener:self];return YES;}// 2. 未读数发生变化后保存未读数- (void)onTotalUnreadMessageCountChanged:(UInt64)totalUnreadCount {self.unreadNumber = totalUnreadCount;}// 3. App 推到后台后上报自定义未读数/** 程序进后台后,自定义 App 的未读数,如果不处理,App 未读数默认为所有会话未读数之和* <pre>** - (uint32_t)onSetAPPUnreadCount {* return 100; // 自定义未读数* }** </pre>*/- (uint32_t)onSetAPPUnreadCount {// 1. 获取自定义的角标uint32_t customBadgeNumber = ...// 2. 加上 IM 的消息未读数customBadgeNumber += self.unreadNumber;// 3. 通过 IMSDK 上报给 IM 服务器return customBadgeNumber;}
io.dcloud.PandoraEntry
。 plus.runtime.setBadgeNumber
设置角标数量。let onTotalUnreadMessageCountUpdated = function(event) {const unreadCount = event.data; // 当前会话的未读总数plus.runtime.setBadgeNumber(unreadCount); // 设置角标数量};chat.on(TencentCloudChat.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED, onTotalUnreadMessageCountUpdated);
本页内容是否解决了您的问题?