Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #20 from ParsePlatform/nlutsenko.12222014.lds
Browse files Browse the repository at this point in the history
Fixed PFQueryTableViewController with Local Datastore.
  • Loading branch information
nlutsenko committed Dec 22, 2014
2 parents 9e3c61c + e99f294 commit 7b82a0a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#import "PFQueryTableViewController.h"

#import <Parse/PFQuery.h>
#import <Parse/Parse.h>

#import "PFActivityIndicatorTableViewCell.h"
#import "PFImageView.h"
Expand Down Expand Up @@ -158,7 +158,7 @@ - (PFQuery *)queryForTable {

// 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) {
if ([self.objects count] == 0 && ![Parse isLocalDatastoreEnabled]) {
query.cachePolicy = kPFCachePolicyCacheThenNetwork;
}

Expand Down Expand Up @@ -192,7 +192,9 @@ - (void)loadObjects:(NSInteger)page clear:(BOOL)clear {
PFQuery *query = [self queryForTable];
[self _alterQuery:query forLoadingPage:page];
[query findObjectsInBackgroundWithBlock:^(NSArray *foundObjects, NSError *error) {
if (query.cachePolicy != kPFCachePolicyCacheOnly && error.code == kPFErrorCacheMiss) {
if (![Parse isLocalDatastoreEnabled] &&
query.cachePolicy != kPFCachePolicyCacheOnly &&
error.code == kPFErrorCacheMiss) {
// no-op on cache miss
return;
}
Expand Down

0 comments on commit 7b82a0a

Please sign in to comment.