1

我正在开发一个应用程序,并且正在处理我想要过滤的联系人列表。因此我正在使用 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 个具有个人标识符。

4

1 回答 1

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;

}
于 2015-08-31T12:12:23.433 回答