本文介绍了如何从 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"]];
您在 Temporary 中也有错别字(除非 Temporay 是某种东西) - 不确定这是否是故意的.
You also have a typo in Temporary (unless Temporay is something) - not sure if that's intentional or not.
这篇关于如何从 Parse iOS 中的同一键获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!