0

I try save relation this way

[pfBill pinInBackgroundWithBlock:^(BOOL succeeded, NSError *PF_NULLABLE_S error)
 {
     [relation addObject:pfBill];

     [pfObjectWithRelations pinInBackgroundWithBlock:^(BOOL succeeded, NSError *PF_NULLABLE_S error)
      {
      }];
 }];

But i can't do it.

    PFRelation *relation = [[PFUser currentUser] relationForKey:@"Relation"];
PFQuery *query = [[relation query] fromLocalDataStore];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
    NSLog(@"%@", objects);
}];

it returns nothing, but if i save relation with saveEventually its return some objects from local datastore

1 Answers1

0

Save the object and pin it on success. Until an object is saved (or pushed to saveEventually IIRC) it doesn't have an objectId and isn't considered as a 'valid' object (so you also can't add it to a relationship).

Wain
  • 118,658
  • 15
  • 128
  • 151