0
我試圖在稱爲userFriendRelationships的解析中創建一個PFobject。該對象旨在存儲兩個用戶指針和另一個稱爲狀態的字段。我不想在解析中使用關係方法,因爲我需要額外的字段狀態。不幸的是,當我嘗試保存對象時,出現以下錯誤。當我在兩個用戶指針都屬於[PFUser currentUser]時創建一個對象時它就起作用,但是當我將其中一個對象設置給另一個用戶時,它會崩潰。該代碼引發錯誤:在PFObject中保存兩個不同用戶的指針
抓好「NSInternalInconsistencyException」有理性「用戶不能保存,除非他們已經通過登錄或註冊認證」:
我的代碼如下:
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];
}
}];
我曾嘗試變化在那裏,我第一次查詢的PFUser myUserContact如下:
PFUser *myUserContact = objects[0];
以及嘗試:
PFUser *myUserContact = [PFObject objectWithoutDataWithClassName:@"_User" objectId:@"GI7CEb2TH6"];
和:
PFUser *myUserContact = [PFUser objectWithoutDataWithObjectId:@"GI7CEb2TH6"];
每一次同樣的錯誤。在userFriendRequests表上沒有設置ACL或CLP。