【问题标题】:Query for Objects with Pointer Array in Parse在 Parse 中使用指针数组查询对象
【发布时间】:2015-04-07 22:21:24
【问题描述】:
  • 我有一个名为restaurantsArray[PFObjects] 数组。
  • 在 Parse 中,有一个类:FoodPhotos,带有指向 RestaurantName 的指针(restaurantsArray 中的对象)

如何查询FoodPhotos 中包含指向restaurantsArray 中对象的指针的所有对象。

类“FoodPhotos”:

基本上我想抓取所有包含指向restaurantArray中对象的指针的美食照片

【问题讨论】:

  • 小建议:它有助于保持你的类名像FoodPhoto而不是FoodPhotos这样的单数。一个名为 foodPhotos 的数组将包含许多 FoodPhoto 对象。
  • 你是对的!我注意到下面的解决方案不起作用,因为我的课程实际上是单数哈哈。在评论中发布了我的 swift 版本

标签: objective-c swift parse-platform


【解决方案1】:

我现在无法测试此代码以确保它有效,但您可以尝试以下方法:

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

这应该只返回RestaurantName 列与restaurantArray 中的对象之一匹配的FoodPhotos 对象。

【讨论】:

  • 谢谢,swift 类似于var query = PFQuery(className:"FoodPhoto") query.whereKey("RestaurantName", containedIn: restaurantArray)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多