Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create local storage
- PFObject *localPhotos = [PFObject objectWithoutDataWithClassName:@"Photo" objectId:objectId];
- [localPhotos setObject:zero forKey:@"count"];
- [localPhotos pinInBackground];
- PFQuery *query = [PFQuery queryWithClassName:@"Photo"];
- [query fromLocalDatastore];
- [[query getObjectInBackgroundWithId:objectId] continueWithBlock:^id(BFTask *task)
- {
- if (task.error)
- {
- // something went wrong
- return task;
- }
- // task.result will be your object
- PFObject *object = task.result;
- NSNumber *counts = object[@"count"];
- // Update counts
- int count = [counts intValue];
- count = count + 1;
- counts = [NSNumber numberWithInt:count];
- // Update UILabel
- _bestsCount.text = [NSString stringWithFormat:@"%@", bestCount];
- [self alignImageView:_bestsLogoWrapper andLabel:_bestsCount inSuperView:_bests];
- // NSLog(@"reachable: %d", isReachable);
- // Update the local datastore
- PFObject *localPhotos = [PFObject objectWithoutDataWithClassName:@"Photos" objectId:photoObjectId];
- [localPhotos setObject:bestCount forKey:@"bestCount"];
- [localPhotos pinInBackground];
- return task;
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement