注册

iOS端获取公共群,得到的是个result,可是我想把所有公共群的列表显示出来

EMError *error = nil; EMCursorResult *result = [[EMClient sharedClient].groupManager getPublicGroupsFromServerWithCursor:nil pageSize:50 error:&error]; if (!error) { NSLog(@"获取成功 -- %@",result); }
 
怎么能获得公共群的列表,包括群名称和群简介
已邀请:
求解决, 在线等, 急用
参考demo这个PublicGroupListViewController类 - (void)reloadDataSource

{

    [self hideHud];

    [self showHudInView:self.view hint:NSLocalizedString(@"loadData", @"Load data...")];

    _cursor = nil;

    

    __weak typeof(self) weakSelf = self;

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        EMError *error = nil;

        EMCursorResult *result = [[EMClient sharedClient].groupManager getPublicGroupsFromServerWithCursor:weakSelf.cursor pageSize:FetchPublicGroupsPageSize error:&error];

        if (weakSelf)

        {

            PublicGroupListViewController *strongSelf = weakSelf;

            dispatch_async(dispatch_get_main_queue(), ^{

                [strongSelf hideHud];

                

                if (!error)

                {

                    NSMutableArray *oldGroups = [self.dataSource mutableCopy];

                    [self.dataSource removeAllObjects];

                    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

                        [oldGroups removeAllObjects];

                    });

                    [strongSelf.dataSource addObjectsFromArray:result.list];

                    [strongSelf.tableView reloadData];

                    strongSelf.cursor = result.cursor;

                    if ([result.cursor length])

                    {

                        self.footerView.state = eGettingMoreFooterViewStateIdle;

                    }

                    else

                    {

                        self.footerView.state = eGettingMoreFooterViewStateComplete;

                    }

                }

                else

                {

                    self.footerView.state = eGettingMoreFooterViewStateFailed;

                }

            });

        }

    });

}

要回复问题请先登录注册