【问题标题】:Quickblox multiple filter on usersQuickblox 对用户的多重过滤器
【发布时间】:2015-12-07 11:48:04
【问题描述】:

我在我的聊天应用程序中使用 Quickblox,我想获得最后 30 位在线男性或女性用户。我使用“标签”表示性别,使用“最后请求时间”表示在线状态。当我获得带有标签的用户时,我不会'不扩展对在线用户的请求,所以我改变了我的设计,并将性别信息保留在“全名”中。此时我需要请求一次并使用 2 个过滤器(最后一个请求和全名)。我使用了 rest api 和 Quickblox课程,但他们没有工作。

是否可以为用户模块使用多个过滤器?

【问题讨论】:

    标签: ios quickblox


    【解决方案1】:

    使用这个方法:

     /**
     Retrieve all Users for current account with extended request
    
     @param extendedRequest Dictionary with extended request
     @param responsePage Pagination parameters
     @param successBlock Block with response, page and users instances if request succeded
     @param errorBlock Block with response instance if request failed
    
     @return An instance of QBRequest for cancel operation mainly.
     */
    + (QB_NONNULL QBRequest *)usersWithExtendedRequest:(QB_NONNULL NSDictionary QB_GENERIC(NSString *, NSString *) *)extendedRequest
                                                  page:(QB_NULLABLE QBGeneralResponsePage *)responsePage
                                          successBlock:(QB_NULLABLE void (^)(QBResponse * QB_NONNULL_S response, QBGeneralResponsePage * QB_NULLABLE_S page, NSArray QB_GENERIC(QBUUser *) * QB_NULLABLE_S users))successBlock
                                            errorBlock:(QB_NULLABLE void (^)(QBResponse * QB_NONNULL_S response))errorBlock;
    

    作为扩展请求使用此过滤器:http://quickblox.com/developers/Users#Filters

    【讨论】:

    • 我已经在问是否可以将此方法与多个过滤器一起使用?
    • 它包含扩展请求的 NSDictionary。只需将所有过滤器放在那里即可。
    • 我已经在使用它但是如果我使用第二个过滤器呢? filters[@"filter[]"] =[NSString stringWithFormat:@"date last_request_at gt %@",dateString]; [用户 getAllUsersWithFilter:过滤器完成:^(NSArray *users, QBError *error) { if (!error) { block(allUsers,nil); } }];
    • 你知道 NSDictionary 是如何工作的吗?只需在那里输入 2 个条目。请在上面的链接中阅读它的密钥。
    • 但是如果我想用全名和最后一个请求过滤怎么办。这些使用相同的参数名称,filter[],这怎么可能?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-27
    相关资源
    最近更新 更多