With the new released iOS8 i have experienced crashes in my TableViews that weren't there before.
I use the following code to calculate the cell heights. This worked wonderfully on iOS7, but crashes on iOS8.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
cell.frame = CGRectMake(0, 0, tableView.frame.size.width, 0);
[cell setNeedsUpdateConstraints];
[cell updateConstraintsIfNeeded];
CGFloat height = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
return height + 1;
}
*** -[UITableViewCell release]: message sent to deallocated instance 0x7d2e2bb0
When this crash happens, i get the following Stacktrace: (Sorry for the Image, can't copy the text out of AppCode)
Here's the Instruments output...
Has anybody seen this behaviour before, or has an idea on how this crash can be prevented?
Okay, got it working now.
The thing is: In your custom UITableViewCell classes, do not set
self.contentView.translatesAutoresizingMaskIntoConstraints = NO;
(Even if you are using AutoLayout)
I don't know why, but when this is set, the crash happens.