I have a situation where sometimes my method -tableView: numberOfRowsInSection:requests an account of freed NSArray. I would like to have the opportunity to check if this array is freed so that it is safe and does not cause zombies.
At the moment, my code is as follows:
-(NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
if (! self.offers){
return 0;
}
return [self.offers count];
}
I just went through this debugger and watched how it passed the test ! self.offers, and then brutally collapsed on [self.offers count]. I have NSZombies enabled, and on this line I get the NSLog message:
-[__NSArrayM count]: message sent to deallocated instance 0x283dc0
Thus, no matter what, in fact, it is not zero, but also does not indicate anything real. How can I check this?
: , . , - , . . :
, .