PFQuery仅返回100

时间:2018-02-13 16:45:47

标签: ios parse-platform pfquery

我认为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,所以它好像我的应用程序完全忽略了该行代码。

1 个答案:

答案 0 :(得分:1)

默认meta为100。

http://parseplatform.org/Parse-SDK-iOS-OSX/api/Classes/PFQuery.html#/Paginating%20Results

  

要返回的对象数量的限制。 默认限制为100 ,一次返回最多1000 结果。

所以请致电:

limit

这是在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

还有一个名为query.limit = xxx 的相关参数,它在服务器范围内代表maxLimit