Parse.com always returns a maximum of 100 records, the same as "limit = 1000"
I have an iOS app that receives data from PARSE.COM. As nothing was known about "parse.com", I used the tutorial " http://www.raywenderlich.com/15916/how-to-synchronize-core-data-with-a-web-service-part-1 " ...
Synchronization occurs only from the server to the device (iOS), and once the object is added to the device, it should not be inserted again.
It turns out I got 131 objects in the class and 145 in the other, but Parse.com always returns me the first 100 elements, even those that are already on the device (iOS).
The worst part is that in my code, I have a "limit" variable in the "request" which should work, but doesn't work for me.
I need your help please ...
Code:
- (NSMutableURLRequest *)GETRequestForAllRecordsOfClass:(NSString *)className updatedAfterDate:(NSDate *)updatedDate
{
NSMutableURLRequest *request = nil;
NSDictionary *paramters = nil;
if (updatedDate) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.'999Z'"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
NSString *jsonString = [NSString
stringWithFormat:@"{\"updatedAt\":{\"$gte\":{\"__type\":\"Date\",\"iso\":\"%@\"}}}",
[dateFormatter stringFromDate:updatedDate]];
//That line of 'paramters' is from original tutorial Raywenderlich
// paramters = [NSDictionary dictionaryWithObject:jsonString forKey:@"where"];
//This line was add for the autors of tutorial in a comment from your blog, and he say that has work, but not for me =(
paramters = @{@"where" : jsonString, @"limit" : @(1000)};
}
request = [self GETRequestForClass:className parameters:paramters];
return request;
}β
The printout of the variable "request" after this method is as follows:
URL: https://api.parse.com/1/classes/Substancia?where=%7B%22updatedAt%22%3A%7B%22%24gte%22%3A%7B%22__type%22%3A%22Date%22%2C%22iso%22%3A%222014-09-23T02%3A13%3A01.999Z%22%7D%7D%7D&limit=1000
Why, given the variable "LIMIT = 1000", does parse.com each return 100 items to me? And even this returns 100 items, why the next time it executes the "query" it won't catch the next 100 since 100 other registers have already been entered previously?
Can anyone help me?
source to share
(Answer here, as I don't have enough reputation to comment.)
- For
limit=1000
that doesn't seem to work: Perhaps the "where" clause (ie restricting items with aupdatedAt
value> = 2014-09-23T02: 13: 01.999Z) limits the results to less than 1000? - (To Ian point) There is a "skip" parameter that tells the API how many items are skipping ahead for pagination. those.
limit=100&skip=100
to see page 2.
source to share