invalid mode 報錯
報錯信息如下
*** Assertion failure in -[GroupShadowTableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.21.8/UITableView.m:7810
invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
在iOS10能正常運行,但在iOS11就會carsh,報錯信息如上,網上搜的出現這種情況場景比較多,有內存泄露的,也有因xib是控件連線錯誤的,於是各種驗證,各種試,最終找到問題出在哪了,因爲cell是自定義高度的,平時都是直接用代碼塊聲明tableView,沒注意到這個問題,有問題代碼如下
- (UITableViewCell *)groupShadowTableView:(GroupShadowTableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
AutobillingCell *cell = [tableView dequeueReusableCellWithIdentifier:AutoCellIDForList forIndexPath:indexPath];
if (!cell) {
cell = [[AutobillingCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:AutoCellIDForList];
}
cell.model = self.dataArray[indexPath.section];
return cell;
}
把
AutobillingCell *cell = [tableView dequeueReusableCellWithIdentifier:AutoCellIDForList forIndexPath:indexPath];
換成
AutobillingCell *cell = [tableView dequeueReusableCellWithIdentifier:AutoCellIDForList];
搞定收工!