我认为PFQuery应该有1000个限制,但是我有一个问题,就是它只返回100个对象,使用以下代码:
- (id)initWithCoder:(NSCoder *)aDecoder
{
NSLog(@"initwithcoder");
self = [super initWithCoder:aDecoder];
if (self) {
NSLog(@"self");
// The className to query on
self.parseClassName = @"Directory";
// Whether the built-in pull-to-refresh is enabled
self.pullToRefreshEnabled = YES;
// Whether the built-in pagination is enabled
self.paginationEnabled = NO;
// The number of objects to show per page
self.objectsPerPage = 0;
}
return self;
}
- (PFQuery *)queryForTable {
NSLog(@"QUERY");
PFQuery *query = [PFQuery queryWithClassName:@"Directory"];
// If no objects are loaded in memory, we look to the cache first to fill the table
// and then subsequently do a query against the network.
if (self.objects.count == 0) {
query.cachePolicy = kPFCachePolicyCacheThenNetwork;
}
NSLog(@"Count%lu", self.objects.count);
[query orderByAscending:@"title"];
return query;
}我尝试使用'0‘,以及'500’或'1000‘,没有变化。即使将其设置为低计数2,仍然返回100,所以我的应用程序似乎完全忽略了这一行代码。
发布于 2018-02-14 00:43:46
默认的limit是100。
http://parseplatform.org/Parse-SDK-iOS-OSX/api/Classes/PFQuery.html#/Paginating%20Results
对要返回的对象数量的限制。默认限制为100,每次返回的最大值为1000个结果。
所以就打电话吧:
query.limit = xxx这是在ParseServerv2.1.0中添加的:
Fix:无限制地进行查询,现在返回100个结果引用:https://github.com/parse-community/parse-server/blob/master/CHANGELOG.md#210-2172016
源代码:https://github.com/parse-community/parse-server/blob/master/src/Routers/ClassesRouter.js#L117
还有一个名为maxLimit的相关参数,它是服务器范围的,表示Max value for limit option on queries, defaults to unlimited
https://stackoverflow.com/questions/48771677
复制相似问题