【问题标题】:Quickblox - How to show the data using custom object with parameters IOSQuickblox - 如何使用带有参数 IOS 的自定义对象显示数据
【发布时间】:2015-05-07 08:10:34
【问题描述】:

我正在开发一个应用程序,并且我正在处理一个我想要过滤的联系人列表。因此我使用的是 quickblox 的自定义对象,这是我的代码:

- (NSArray *)idsFromContactListItems { 
   NSMustableArray *idsToFetch = [NSMustableArray new];
   NSArray *contactListItems = self.contactList; 
   for (QBContactListItem *item in contactListItems) { 
       NSMutableDictionary *getRequest = [NSMutableDictionary new];
       [getRequest setObject:@"personal" forKey:@"identifier"];
       if ([QBCustomObjects objectsWithClassName=@"cards" extendedRequest:getRequest delegate:self]){
           idsToFetch addObject:@(item.userID)];}
           else {}; 
   } 
   return idsToFetch;
  };

我的数组 idsToFetch 返回所有值,但在我的自定义对象类中只有 1 个具有个人标识符。

【问题讨论】:

    标签: ios quickblox custom-object


    【解决方案1】:

    [QBCustomObjects objectsWithClassName=@"cards" extendedRequest:getRequest delegate:self] 将在 self 上调用 completedWithResult: 方法(请注意,这是不推荐使用的 api,它已在最新的 2.3.0.4 中删除,但仍可在具有旧 API 1.x 支持的最新 2.2.5 SDK 中使用)

    [QBCustomObjects objectsWithClassName=@"cards" extendedRequest:getRequest delegate:self]
    

    会打电话

    - (void)completedWithResult:(QBResult *)result {
    // in result you will have QBCOCustomObjectPagedResult
    QBCOCustomObjectPagedResult *res = (QBCOCustomObjectPagedResult *)result;
    // to get your items in array with identifier == presonal you can use
    NSArray *customObjects = res.objects;
    
    }
    

    【讨论】:

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