简体   繁体   English

获取Quickblox聊天中的用户列表

[英]Get list of users in quickblox chat

i need to get how to do implement this i want a particular user to be the admin, if the admin logs in then all users in my Quickblox account displays in the UserFragment class(which is the default), if other user logs in, the UserFragment class should only display the admin. 我需要获取实现方法,我希望特定用户成为管理员,如果管理员登录,则我的Quickblox帐户中的所有用户都将显示在UserFragment类中(这是默认设置),如果其他用户登录, UserFragment类应仅显示管理员。 Which means the admin can chat with other users and other users can only chat with the admin. 这意味着管理员可以与其他用户聊天,而其他用户只能与管理员聊天。

 [QBRequest logInWithUserEmail:@"adminEmail" password:@"adminPassword" successBlock:^(QBResponse * _Nonnull response, QBUUser * _Nullable user) {
     //You get userid of admin in user.ID

     if(user.ID == 1234567){ //Pass ID of your admin which you can take from https://admin.quickblox.com 
         // Fetch all users                      
     }else{
         // Retrieve user by ID for admin
     } 
 errorBlock:^(QBResponse * _Nonnull response) {
         // Handle error               
  }];

Now, for fetching all users you can use. 现在,为了获取所有用户,您可以使用。

QBGeneralResponsePage *page = [QBGeneralResponsePage responsePageWithCurrentPage:1 perPage:10];

[QBRequest usersForPage:page successBlock:^(QBResponse *response, QBGeneralResponsePage *pageInformation, NSArray *users) {

     // Successful response contains current page infromation + list of users

 } errorBlock:^(QBResponse *response) {
     // Handle error
}];

Now, for fetching admin details. 现在,用于获取管理员详细信息。

//Pass your admin ID here
[QBRequest usersWithIDs:@[@12345] page:[QBGeneralResponsePage responsePageWithCurrentPage:1 perPage:10] successBlock:^(QBResponse *response, QBGeneralResponsePage *page, NSArray *users) {

      // Details of admin in users
 } errorBlock:^(QBResponse *response) {
      // Handle error here
 }];

You can also refer this link for fetching users 您也可以参考此链接来获取用户

https://quickblox.com/developers/SimpleSample-users-ios#Retrieving_all_Users https://quickblox.com/developers/SimpleSample-users-ios#Retrieving_all_Users

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM