I am trying to create an PFobject in parse called userFriendRelationships. The object is meant to store two User pointers and another field called status. I don't want to use the relationship method in parse because I need the additional field status. Unfortunately, I am getting the following error when I try to save the object. It works when I make an object when both User pointers belong to [PFUser currentUser], but it will crash when I set one of the objects to a different user. The code throws the error:
Caught "NSInternalInconsistencyException" with reason "User cannot be saved unless they have been authenticated via logIn or signUp":
My Code is as follows:
PFObject *userFriendRequest = [PFObject objectWithClassName:@"userFriendRequests"];
[userFriendRequest setObject:myUserContact forKey:@"invited"];
[userFriendRequest setObject:[PFUser currentUser] forKey:@"inviter"];
[userFriendRequest setObject:@"pending" forKey:@"status"];
[userFriendRequest saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error){
if (succeeded) {
UILabel *disclosureLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 65, 21)];
disclosureLabel.backgroundColor = [UIColor whiteColor];
disclosureLabel.textColor = [UIColor greenColor];
[disclosureLabel setText:@"Invited"];
[cell setAccessoryView:disclosureLabel];
[[self.allKnownUsers objectAtIndex:indexPath.row] setObject:@"pending" forKey:@"status"];
[self.tableView reloadData];
}
else {
//NSLog(@"Error %@",error);
[cell setAccessoryView:nil];
}
}];
I have tried variations where, I first query for a PFUser myUserContact as follows:
PFUser *myUserContact = objects[0];
as well as trying:
PFUser *myUserContact = [PFObject objectWithoutDataWithClassName:@"_User" objectId:@"GI7CEb2TH6"];
and:
PFUser *myUserContact = [PFUser objectWithoutDataWithObjectId:@"GI7CEb2TH6"];
Same error each time. There are no ACLs or CLPs set on the userFriendRequests table.