0

I'm trying to fetch data from 5 different classes on Parse using the same PFQuery.

Most of the classes have more than 100 objects in it, but apart from the first class I fetch all the other classes (that have more than 100 objects) returns just 100.

*The first class that I fetch from returns the correct number, after it, just 100.

My code:

PFQuery *query=[PFQuery queryWithClassName:@"Music"]; // 216 objects in class
query.limit=1000;

[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
    if (error) {
        NSLog(@"Error: %@",[error description]);
    }
    //"objects"'s count: 216 objects
}];

query=[PFQuery queryWithClassName:@"Movies"]; //95 objects in class
[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
    if (error) {
        NSLog(@"Error: %@",[error description]);
    }
    //"objects"'s count: 95 objects
}];

query=[PFQuery queryWithClassName:@"Theater"]; //288 objects in class
[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
    if (error) {
        NSLog(@"Error: %@",[error description]);
    }
    //"objects"'s count: 100 objects
}];

query=[PFQuery queryWithClassName:@"Food"]; //558 objects in class
[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
    NSLog(@"Objects count: %lu",objects.count);
    if (error) {
        NSLog(@"Error: %@",[error description]);
    }
    //"objects"'s count: 100 objects
}];

query=[PFQuery queryWithClassName:@"Toys"]; //21 objects in class
[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
    if (error) {
        NSLog(@"Error: %@",[error description]);
    }
    //"objects"'s count: 21 objects
}];

I'll be really thankful if someone could help me with this problem, Thank you!

Yhper
  • 183
  • 2
  • 14
  • Are you getting any error message ? – nikhil84 Jan 06 '16 at 09:03
  • Parse limit fetch data to 100. Checkout this [link](http://stackoverflow.com/questions/17246991/parse-com-retrieve-more-than-1000-rows) will be helpful. – nikhil84 Jan 06 '16 at 09:04
  • @nikhil84 I set "query.limit" to 1000 (and even tried to use different queries for each fetch, still the same problem). I want to fetch from different classes that has less than 1000 objects each. I don't get any errors – Yhper Jan 06 '16 at 09:12
  • try getting instead of the objects, the count: `countObjectsInBackgroundWithBlock` – Dani Pralea Jan 06 '16 at 10:36
  • does this problem have no solution. Is it a reason for us to give up on Parse? – nyxee Jul 31 '17 at 18:11

0 Answers0