1
我有兩個類User
和Post
。 User
類有一個userType
字段,我想檢索給定的所有帖子userType
讓我們稱它們爲組x。在Post
類中,我有一個指向User
類的指針。IOS解析如何從基於兩個類的查詢中檢索對象?
我試圖做這樣的事情,首先檢索所有用戶ID爲我要的用戶類型:
PFQuery *queryUser = [PFQuery queryWithClassName:kFTUserClassKey];
[queryUser whereKey:kFTUserTypeKey equalTo:kFTUserTypeX];
[queryUser whereKey:kFTUserLocationKey nearGeoPoint:nearGeoPoint withinMiles:miles];
[queryUser findObjectsInBackgroundWithBlock:^(NSArray *usersTypeX, NSError *error) {
if (!error) {
NSMutableArray *objectIds = [[NSMutableArray alloc] init];
// Add ambassador ids into query
for (PFObject *userX in usersTypeX) {
[objectIds addObject:[PFObject objectWithoutDataWithClassName:kFTUserClassName objectId: userX.objectId]];
}
}
}];
然後我想基於這些的ObjectID查詢,但我不知道如何查詢在這個數組上,或者如果這是甚至正確的方式來做到這一點。如何才能做到這一點?