Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Please help with PFQuery in UITableView

pedrogr90pedrogr90 MurciaPosts: 1New Users Noob
edited April 2015 in iOS SDK Development
Hi guys ! This is my first post and I would like to say i am a newbie in this topic about iOS development.

My problem is simple:

I have a UITableView with cells. In the method:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

I have a Parse query in which i want to get the vacants for just the selected cell.

My query is this :
PFQuery *query = [PFQuery queryWithClassName:@"Event"];
    [query selectKeys:@[@"Vacants"]];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            // Do something with the found objects
            for (NSObject *object in objects) {
                NSLog(@"%@", [object valueForKey:@"Vacants"]);
            [Event saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {

This query gets me all the vacants from my cloud, but i just want the vacant of the selected row in the cell. Afterwards, I subtract 1 to the vacants number and upload it back to Parse.
Sign In or Register to comment.