Search code examples
iosiphonexmppchatquickblox

QuickBlox: How to get all members of room?


How can we get all member of room in QuickBlox iOS SDK. In web SDk of QuickBlox we can find by bellow link. but I am not able to find same for iOS SDK

http://quickblox.com/developers/Web_XMPP_Chat_Sample#Managing_members

Any help will be appreciated.


Solution

  • For retrieving the all members of the group first fetch the particular dialogue for which you want to get the member and it gives you this kind of response.

    Dialogs: (
    ID:554864c6535c12ac9a0f63dc                      
    Room JID:[email protected]                      
    name:3                      
    photo:(null)                      
    type:2                      
    lastMessage:(null)                      
    lastMessageDate:(null)                      
    occupantIDs:(\n    2067069,\n    2107873,\n    2976970\n)                      
    userID:2976970                      
    unreadMessagesCount:0                      
    lastMessageUserID:0"
    )
    

    here you can see you have the occupants id of the all users in the group now you have to find the all users with this occupants ids.

        NSArray *occupantsUsersIDs = [dialogname valueForKey:@"occupantIDs"];
        //
        [QBRequest usersWithIDs:occupantsUsersIDs page:pagedRequest successBlock:^(QBResponse *response, QBGeneralResponsePage *page, NSArray *users) {
    
         NSLog(@"Users %@",users);
            //
        } errorBlock:nil];