0
  • 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

2
  • Minor suggestion: It helps to keep your class name singular like FoodPhoto instead of FoodPhotos. An array called foodPhotos would contain many FoodPhoto objects. Commented Feb 7, 2015 at 23:04
  • 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 Commented Feb 8, 2015 at 6:43

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, swift is something like var query = PFQuery(className:"FoodPhoto") query.whereKey("RestaurantName", containedIn: restaurantArray)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.