Skip to content

Instantly share code, notes, and snippets.

@tranhieutt
Last active January 3, 2016 14:36
Show Gist options
  • Save tranhieutt/61aa6f973c8d61b6b9d9 to your computer and use it in GitHub Desktop.
Save tranhieutt/61aa6f973c8d61b6b9d9 to your computer and use it in GitHub Desktop.
Get Object from Class in Parse
-(void)getGroupAccessory:(NSString *)groupAccessoryName withCompletion:(void(^)(BOOL success))completion failure:(void(^)(HondaFailureCode failureCode))failure{
PFQuery *query = [PFQuery queryWithClassName:@"HondaItem"];
[query whereKey:@"groupAccessary" hasPrefix:@"Điện"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// The find succeeded.
if ([self convertPFObjectToHondaDataItem:objects].count) {
completion([self convertPFObjectToHondaDataItem:objects]);
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment