我是Parse.com的新手我试着用相同的键从Parse表中获取数据但是值不同如
-(void)getdata
{
NSMutableArray *allObjects = [NSMutableArray array];
NSUInteger limit = 1000;
__block NSUInteger skip = 0;
PFQuery *query = [PFQuery queryWithClassName:@"MapInfo"];
PFQuery *query = [PFQuery queryWithClassName:@"MapInfo"];
[query whereKey:@"Type" containedIn:@[@"Temopary", @"Business"]];
[query setLimit: limit];
[query setSkip: skip];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
[allObjects addObjectsFromArray:objects];
if (objects.count == limit) {
skip += limit;
[query setSkip: skip];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
[allObjects addObjectsFromArray:objects];
self.lqpinname=[allObjects valueForKey:@"GPIN"];
NSLog(@"Qpin name COunt %@",self.lqpinname);
self.locationArray=[allObjects valueForKey:@"Location"];
self.llatitude=[self.locationArray valueForKey:@"lat"];
self.llongitude=[self.locationArray valueForKey:@"lng"];
self.laddress=[allObjects valueForKey:@"Address"];
self.lusernameArray=[allObjects valueForKey:@"AddedBy"];
hudView.hidden=TRUE;
}];
}
}
else
{
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
}
但是这里返回Null
值我想从表中获取数据Type=Business & Temporary
列请给我解决方案。
感谢。
答案 0 :(得分:1)
您应该可以使用whereKey:containedIn:
来执行此操作。
PFQuery *query = [PFQuery queryWithClassName:@"MapInfo"];
[query whereKey:@"Type" containedIn:@[@"Temopary", @"Business"]];
你也有临时错字(除非Temporay是东西) - 不确定这是否是故意的。