简体   繁体   中英

Query Parse Object based on empty relation

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.

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];

        }
    }];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM