3

In a PFQueryTableViewController with paging enabled and which displays sections:

 self.paginationEnabled = YES;
 self.pullToRefreshEnabled = YES;
 self.objectsPerPage = 3;

I get this error when I press the next page button:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete row 3 from section 0 which only contains 1 rows before the update

I have replaced the row-based data displaying with this section-based data displaying:

- (PFObject *)objectAtIndexPath:(NSIndexPath *)indexPath {
  if (indexPath.section < self.objects.count) {
    return [self.objects objectAtIndex:indexPath.section];
  }
  return nil;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  NSInteger sections = self.objects.count;
  if (self.paginationEnabled && sections != 0)
    sections++;
  return sections;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  return 1;
}

How is it possible to keep the section-base pfquerytableview controller if the next page method tries to delete the next page cell, which if I'm not wrong, should be the last cell of the tableview (instead of the last section). This behavior seems to work in other examples given by Parse, such as the Anypic app..

stefano_cdn
  • 1,362
  • 2
  • 15
  • 29

0 Answers0