parse.com 2“doesNotMatchKey”在一个查询中

时间:2014-01-13 17:05:52

标签: ios iphone parse-platform

是否可以在一个查询中添加2个“doesNotMatchKey”?我试图不显示被保存的“优惠”。不显示已删除的优惠

// get query for all deleted offers
PFQuery *innerQuery = [PFQuery queryWithClassName:P_CLASS_DELETED_OFFERS];
[innerQuery whereKey:P_DELETED_OFFER_USER_30X01 equalTo:[PFUser currentUser]];

// get query for all saved offers
PFQuery *innerSavedOfferQuery = [PFQuery queryWithClassName:P_CLASS_SAVED_OFFER];
[innerSavedOfferQuery whereKey:P_SAVED_OFFER_USER_29X01 equalTo:[PFUser currentUser]];

//main query
PFQuery *query = [PFQuery queryWithClassName:P_CLASS_OFFER];
**[query whereKey:P_OBJECT_ID_CCX98 doesNotMatchKey:P_SAVED_OFFER_OFFER_STRING_ID_29X03       inQuery:innerSavedOfferQuery];
[query whereKey:P_OBJECT_ID_CCX98 doesNotMatchKey:P_DELETED_OFFER_OFFER_STRING_ID_30X03 inQuery:innerQuery];**
[query whereKey:P_OFFER_ITEM_20X02 containedIn:[NSArray arrayWithArray:[DataManager sharedInstance].myWantitArray]];
[query orderByAscending:P_OFFER_ITEM_20X02];
[query includeKey:P_OFFER_ITEM_20X02];
[query includeKey:P_OFFER_USER_20X01];

return query;

我将此插入到PFQueryTableController并获得与主查询匹配的结果而没有第二个“doesNotMatchKey:”方法,在这种情况下 - [查询whereKey:P_OBJECT_ID_CCX98 doesNotMatchKey:P_DELETED_OFFER_OFFER_STRING_ID_30X03 inQuery:innerQuery];被忽略了。

1 个答案:

答案 0 :(得分:-1)

你想要的是whereKey:notContainedIn:方法。这使您可以提供要检查的键数组。