Start a new topic

KCSCachedStore returns one record at a time when offline (using Framework v1.27.0 but not 1.26.9)

Using a really basic query (see below), I'm getting the right response when online - e.g. 4 records which are then rendered in a UITableView.



But when there's no network connection (i.e. offline), I get unexpected behaviour: `objectsOrNil` only ever contains one record. If I re-query, it gets the next record, and so on, cycling around the whole collection - but only returning a single record at a time.



This is with Framework v 1.27.0. If I replace with 1.26.9, the behaviour reverts to what I'm expecting - which is the same 4 records returned as when online. I've also tried with versions 1.26.8 and 1.26.6.



I'm sticking with 1.26.9 for the time being, but could something be broken in the latest version?



```

KCSCollection* collection = [KCSCollection collectionFromString:@"Sightings" ofClass:[WSSighting class]];

sightingsStore = [KCSCachedStore storeWithCollection:collection options:@{KCSStoreKeyCachePolicy : @(KCSCachePolicyLocalFirst)}];



KCSQuery *query = [KCSQuery query];

[query addSortModifier:[[KCSQuerySortModifier alloc] initWithField:@"spottedWhen" inDirection:kKCSDescending]];

[query setLimitModifer:[[KCSQueryLimitModifier alloc] initWithLimit:100]];



[sightingsStore queryWithQuery:query withCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {

if (errorOrNil != nil) {

NSLog(@"An error occurred on fetch: %@", errorOrNil);

} else {

sightings = objectsOrNil;

// Do something with `sightings` records

}

} withProgressBlock:nil];

```

Hey Jonathan,

It's quite possible, based in what you've told us here. I've brought this to the attention of our iOS library author and he'll be digging into it. Thank you very much for bringing this to our attention!
This should be fixed now in 1.27.1 http://devcenter.kinvey.com/ios/downloads
Login or Signup to post a comment