我在 Parse.com 上有对象 GroupRequest 和 Group。每个 GroupRequest 都有一个指向名为“group”的 Group 对象的指针。我已查询获取 GroupRequests 数组,现在我试图在 TableView 中的该数组中的 GroupRequests 中显示每个组的“名称”字符串属性。
但是,当我尝试访问 [@"name"] 时遇到了麻烦。程序崩溃并说:
“'NSInternalInconsistencyException',原因:'键“name”没有数据。在获取其值之前调用 fetchIfNeeded。'”
如何正确访问组名?下面是我用来尝试访问 [@"name"] 属性的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"notificationCell" forIndexPath:indexPath];
self.pendingRequestBeingDisplayed = [self.pendingRequests objectAtIndex:indexPath.row];
self.tempGroup = self.pendingRequestBeingDisplayed[@"group"];
cell.textLabel.text = self.tempGroup[@"name"];
return cell;
self.pendingRequests 是 GroupRequest 对象的数组。
最佳答案
你需要通过写来获取指针字段
[query includeKey:@"group"];
关于ios - Parse.com 无法访问指向 PFObject 的指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28408082/