1

I have a parse object that I need to query based on a PFRelation property. I need to query for all objects in which the relation is empty and all objects in which the relation is not empty. What's the best approach for this? I'm using the iOS SDK.

codeetcetera
  • 3,213
  • 4
  • 37
  • 62

1 Answers1

-1
PFUser * currentUser = [PFUser currentUser];
PFRelation *relation = [currentUser relationForKey:@"habits"];
PFObject *object = [PFObject objectWithClassName:@"Habit"];
object[@"name"] = @"gym";

[object saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
       if (!error) {

            [relation addObject:object];
            [currentUser saveInBackground];

        }
    }];
Kamalkumar.E
  • 254
  • 2
  • 11