【问题标题】:Get list of users in quickblox chat获取 quickblox 聊天中的用户列表
【发布时间】:2017-03-07 11:10:09
【问题描述】:

我需要知道如何实现这个 我希望特定用户成为管理员,如果管理员登录然后 我的 Quickblox 帐户中的所有用户都显示在 UserFragment 类中(这是默认值), 如果其他用户登录,UserFragment 类应该只显示管理员。 这意味着管理员可以与其他用户聊天,而其他用户只能与管理员聊天。

【问题讨论】:

    标签: ios iphone chat quickblox


    【解决方案1】:
     [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               
      }];
    

    现在,用于获取您可以使用的所有用户。

    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
    }];
    

    现在,用于获取管理员详细信息。

    //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
     }];
    

    你也可以参考这个链接来获取用户

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多