This seems to be a common problem, but I can't figure out anything from the answers I've seen so far. I have an iPhone app that uses a subclass of NSMutableArray
to store objects, plus some additional properties. The subclass is skhCustomArray
. The subclass initializes fine, with no objects in the skhCustomArray
, and I assign it to the the property of my view controller, which is a pointer to an skhCustomArray
.
prescriptionListVC* newPrescList = [[prescriptionListVC alloc] initWithNibName:@"PrescriptionList" bundle:nil];
newPrescList.curPersonPrescriptions = [personDetails objectAtIndex:0];
That works fine. Yet when I push my view managed by my view controller onto the navigation controller stack, the count method in the numberOfRowsInSection
method crashes the app, see below.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [curPersonPrescriptions count];
}
What could be causing this? How can a valid custom array, with no objects, not return a valid count? Where am I going wrong? Thanks.