[英]PFQuery Only Returning 100
我以為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,所以好像我的應用程序完全忽略了這一行代碼。
默認limit
為100。
http://parseplatform.org/Parse-SDK-iOS-OSX/api/Classes/PFQuery.html#/Paginating%20Results
對要返回的對象數的限制。 默認限制為100 ,一次最多返回1000個結果。
因此,只需致電:
query.limit = xxx
這是在Parse Server v2.1.0中添加的:
修復:現在無限制查詢將返回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
的Max value for limit option on queries, defaults to unlimited
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.