0
votes
  • I have an array of [PFObjects] called restaurantsArray.
  • Within Parse, there is a Class: FoodPhotos with pointers to RestaurantName (the objects in restaurantsArray)

How can I query for all objects within FoodPhotos that contain the pointer to an object in restaurantsArray.

Class "FoodPhotos":

enter image description here

Basically I want to grab all the Food Photos that contain a pointer to an object in restaurantArray

1
Minor suggestion: It helps to keep your class name singular like FoodPhoto instead of FoodPhotos. An array called foodPhotos would contain many FoodPhoto objects. - ozz
You're right! I noticed the solution below wasn't working because my class is actually singular haha. Posted my swift version in the comment - Onichan

1 Answers

1
votes

I can't test this code right now to be sure it works, but you could try something like the following:

PFQuery *query = [FoodPhotos query]; // Or ... = [PFQuery queryWithClassName:@"FoodPhotos"];
[query whereKey:@"RestaurantName" containedIn:restaurantArray];

This should only return FoodPhotos objects who's RestaurantName column matches one of the objects in restaurantArray.