如何从 Parse iOS 中的相同键获取数据?
How to fetch Data From Same Key in Parse iOS?
我是 Parse.com 的新手,我尝试使用相同的键从 Parse table 中获取数据,但值不同,如
-(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]);
}
}];
}
但这是 return Null
值,我想从 table 列 Type=Business & Temporary
中获取数据,请给我解决方案。
谢谢。
您应该可以使用 whereKey:containedIn:
来执行此操作。
PFQuery *query = [PFQuery queryWithClassName:@"MapInfo"];
[query whereKey:@"Type" containedIn:@[@"Temopary", @"Business"]];
你在 Temporary 中也有错字(除非 Temporay 是什么东西)- 不确定这是不是故意的。
我是 Parse.com 的新手,我尝试使用相同的键从 Parse table 中获取数据,但值不同,如
-(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]);
}
}];
}
但这是 return Null
值,我想从 table 列 Type=Business & Temporary
中获取数据,请给我解决方案。
谢谢。
您应该可以使用 whereKey:containedIn:
来执行此操作。
PFQuery *query = [PFQuery queryWithClassName:@"MapInfo"];
[query whereKey:@"Type" containedIn:@[@"Temopary", @"Business"]];
你在 Temporary 中也有错字(除非 Temporay 是什么东西)- 不确定这是不是故意的。