Sync object retrieval on Backendless 4.0

I need to retrieve objects synchronously using Backendless 4.0. How can I prepare the Data Query Builder next page synchronously using iOS SDK?

Did you see the doc on data paging?

Yes, I saw it, but I didn’t find out how to access next page using the sync method.

The nextPage method simply recalculates the offset. You would need to use the find method to fetch data.

Please, check this:

-(void)paging:(DataQueryBuilder *)queryBuilder {
    NSArray *people = [[backendless.data of:[Person class]] find:queryBuilder];
    if (people.count != 0) {
        NSLog(@"Loaded %d people in the current page", (int)people.count);
        for (Person *person in people) {
            NSLog(@"%@, age %i", person.name, (int)person.age);
        }
        [self paging:[queryBuilder prepareNextPage]];
    }
    else {
        NSLog(@"Reached the end of collection");
    }
}

Regards, Olga

Well, but now it obligates us to increase the number of requisitions to the database once I need to use a recursive method.

Whether you use the sync approach or the async one, the number of database requests would be the same.

Yes, but it will be greater than the Backendless 3.0 API

This is not right. The prepareNextPage method is not an API call, it merely does the following:

offset += pageSize;