本文介绍了如何在Parse iOS中从同一个键获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Parse.com的新手,我尝试使用相同的密钥从Parse表中获取数据,但值不同,如
i am newbie in to Parse.com i try to Fetch data from Parse table with same key but value is Different like as
-(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&临时
请给我解决方案。
But it is return Null
value here i want to Fetch data from table where column Type=Business & Temporary
Please Give me Solution for this.
谢谢。
推荐答案
你应该可以使用 whereKey:containedIn:
来做这个。
You should be able to use whereKey:containedIn:
to do this.
PFQuery *query = [PFQuery queryWithClassName:@"MapInfo"];
[query whereKey:@"Type" containedIn:@[@"Temopary", @"Business"]];
你也有临时错字(除非是Temporay) - 不确定这是否是故意的。
You also have a typo in Temporary (unless Temporay is something) - not sure if that's intentional or not.
这篇关于如何在Parse iOS中从同一个键获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!