问题描述
解决方案
ChatListViewController 里面相应的代码注释了 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{这个方法里面的代码 else{ NSString *imageName = @"groupPublicHeader";// if (![conversation.ext objectForKey:@"groupSubject"] || ![conversation.ext objectForKey:@"isPublic"])// { NSArray *groupArray = [[EaseMob sharedInstance].chatManager groupList]; for (EMGroup *group in groupArray) { if ([group.groupId isEqualToString:conversation.chatter]) { cell.name = group.groupSubject; imageName = group.isPublic ? @"groupPublicHeader" : @"groupPrivateHeader"; NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithDictionary:conversation.ext]; [ext setObject:group.groupSubject forKey:@"groupSubject"]; [ext setObject:[NSNumber numberWithBool:group.isPublic] forKey:@"isPublic"]; conversation.ext = ext; break; } }// }// else// {// cell.name = [conversation.ext objectForKey:@"groupSubject"];// imageName = [[conversation.ext objectForKey:@"isPublic"] boolValue] ? @"groupPublicHeader" : @"groupPrivateHeader";// } cell.placeholderImage = [UIImage imageNamed:imageName]; }
解决方案二:
因为[[EaseMob sharedInstance].chatManager groupList]方法是从本地缓存中获取群组列表信息,所以,修改群名称后,需要调用asyncFetchMyGroupsListWithCompletion方法(从服务端获取最新的群列表信息),从而触发本地群组列表的缓存刷新。在ConversationListController中,群组的名称是通过遍历 [[EaseMob sharedInstance].chatManager groupList]获取最新的群信息,然后重组self.conversation.ext字典,这样才能显示最新的群名称。