我有一个名为Subcategory的类,其中一个名为category的列是一个指针。我试图调用并存储特定行的指针。什么都没有存储到self.categoryName.text?谢谢你的期待。
这是我的代码:
PFQuery *query = [PFQuery queryWithClassName:@"SubCategory"];
[query whereKey:@"user" equalTo:[PFUser currentUser]];
[query whereKey:@"name" equalTo:@"Food"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
for (PFObject *object in objects) {
self.subcategoryName.text = object[@"name"];
self.categoryName.text = object[@"category"];
}
}];
答案 0 :(得分:2)
使用像这样的查询
[query whereKey:@"user" equalTo:[PFUser currentUser]];
[query includeKey:@"Food"];