Interface Builder Potential Issue

So I have an UITableViewController with custom Cells defined in a separate .xib Files. It's working fine on IOS 13+ but it doesn't work on IOS 12-

I got this error: Unknown class TtC6myModule24UITableViewCell in Interface Builder file.
Following by Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewCell 0x7fb48e81a800> setValue:forUndefinedKey:]: this class **** is not key value coding-compliant for the key *.'

I've checked all my IBOutlets, and connections i even recreated the cells from scratch so that XCode can regenerate The identifiers, but it keeps crashing, i've been able to reproduce the problem on simulators running iOS 12 and lesser versions.

here is the stacktrace.

* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewCell 0x7fb48e81a800> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key badgeImage.'
  • ** First throw call stack:

(
0  CoreFoundation           0x0000000109453b0b
exceptionPreprocess + 171
1  libobjc.A.dylib           0x0000000108e73141 objc
exceptionthrow + 48
2  CoreFoundation           0x0000000109453a59 -[NSException raise] + 9
3  Foundation             0x00000001064af00b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4  UIKit                0x00000001073a9e08 -[UIView(CALayerDelegate) setValue:forKey:] + 172
5  UIKit                0x00000001076efa09 -[UIRuntimeOutletConnection connect] + 109
6  CoreFoundation           0x00000001093f9e8d -[NSArray makeObjectsPerformSelector:] + 269
7  UIKit                0x00000001076ee3bf -[UINib instantiateWithOwner:options:] + 1856
8  UIKit                0x00000001074408b7 -[UITableView
dequeueReusableViewOfType:withIdentifier:] + 402
9  UIKit                0x0000000107440d9b -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 71
10 packid               0x0000000104af30ee $s6packid7AccesVcC9tableView12cellForRowAtSo07UITableE4CellCSo0jE0C10Foundation9IndexPathVtF + 9598
11 packid               0x0000000104af5145 $s6packid7AccesVcC9tableView12cellForRowAtSo07UITableE4CellCSo0jE0C10Foundation9IndexPathVtFTo + 165
12 UIKit                0x0000000107453ab2 -[UITableView createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 750
13 UIKit                0x0000000107453cf8 -[UITableView
createPreparedCellForGlobalRow:willDisplay:] + 74
14 UIKit                0x0000000107428639 -[UITableView updateVisibleCellsNow:isRecursive:] + 2845
15 UIKit                0x000000010745cccc -[UITableView
performWithCachedTraitCollection:] + 111
16 UIKit                0x0000000107443e7a -[UITableView layoutSubviews] + 233
17 UIKit                0x00000001073aa55b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
18 QuartzCore             0x000000010a11a904 -[CALayer layoutSublayers] + 146
19 QuartzCore             0x000000010a10e526 ZN2CA5Layer16layoutifneededEPNS11TransactionE + 370
20 QuartzCore             0x000000010a10e3a0 ZN2CA5Layer28layoutanddisplayifneededEPNS11TransactionE + 24
21 QuartzCore             0x000000010a09de92 ZN2CA7Context18committransactionEPNS11TransactionE + 294
22 QuartzCore             0x000000010a0ca130
ZN2CA11Transaction6commitEv + 468
23 QuartzCore             0x000000010a0cab37 ZN2CA11Transaction17observercallbackEP19_CFRunLoopObservermPv + 115
24 CoreFoundation           0x00000001093f9717 CFRUNLOOP
ISCALLINGOUTTOANOBSERVERCALLBACKFUNCTION + 23
25 CoreFoundation           0x00000001093f9687
CFRunLoopDoObservers + 391
26 CoreFoundation           0x00000001093de038 CFRunLoopRunSpecific + 440
27 UIKit                0x00000001072e108f -[UIApplication
run] + 468
28 UIKit                0x00000001072e7134 UIApplicationMain + 159
29 packid               0x0000000104b6dd5b main + 75
30 libdyld.dylib            0x000000010ae5265d start + 1
31 ???                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I have deleted My cells, and i've recreated the files from scratch and still have this exception
Did you register the cell nib ?

In viewDidLoad, register the nib (I assume it is "TableViewCell.xib", and that UITableView is named tableView and that cell ID is CellID

Code Block
let nib = UINib(nibName: "TableViewCell", bundle: nil)
self.tableView.register(nib, forCellReuseIdentifier: "CellID")

Most Certainly the nib registered correctly. Otherwise i would have received an other Exception, The thing that i find most bizarre is the fact that the same implementation is running perfectly on my iPhone XR with iOS 13.
How do you use badgeImage ?

Could you please show the complete code for cellForRow (where you call dequeue) ?
Code Block    @IBOutlet weak var cellCard: MDCCard!
  @IBOutlet weak var progressBar: IndeterminateProgressBar!
  @IBOutlet weak var notifyOnZoneCheck: CheckBox!
  @IBOutlet weak var detailsNavigationButton: CustomButton!
  @IBOutlet weak var dropSquareView: UIView!
  @IBOutlet weak var dropArrowImage: UIImageView!
  @IBOutlet weak var badgeTitleLabel: UILabel!
  @IBOutlet weak var badgeStateLabel: UILabel!
  @IBOutlet weak var blePresenceIndicatorView: UIView!
  @IBOutlet weak var faveCheckbox: CheckBox!
  @IBOutlet weak var transactionAnimView: UIView!
  @IBOutlet weak var transactionStateLabel: UILabel!
  @IBOutlet weak var badgeImage: UIImageView!
  @IBOutlet weak var verticalEffectView: UIView!
  @IBOutlet weak var halfCircleLayerView: UIView!
 override func awakeFromNib() {
    super.awakeFromNib()
    let gestureReco = UITapGestureRecognizer(target: self, action: #selector(didTapExpand))
    if let image = dropArrowImage {
      image.addGestureRecognizer(gestureReco)
    }
    cellCard?.enableRippleBehavior = false
    cellCard?.isInteractable = false
    cellCard?.cornerRadius = 10
    cellCard?.setShadowElevation(ShadowElevation(rawValue: 4), for: .normal)
    progressBar?.primaryColor = UIColor.systemOrange
    progressBar?.secondaryColor = UIColor.clear
    readerRSSI = nil
    transactionAnimView.layer.cornerRadius = 10;
  }
  override func prepareForReuse() {
    super.prepareForReuse()
    badgeImage?.image = nil
    shapeLayer.removeFromSuperlayer()
    self.badge = nil
    onDropDownClicked = nil
    onBleClicked = nil
    progressBar?.isHidden = !isIndeterminateAnimationRunning
    readerRSSI = nil
    isLastCellInSection = false
  }


Check the connection of badgeImage IBOutlet. It may be damaged. So, remove the connection and rebuild it.

You should try removing override func prepareForReuse, just to check.

In addition, can you provide the code of tableView(_:cellForRowAt:) ?
Have you tried editing source code of the storyboard file? Open as source code and then search for the class or object that's causing the error and removed its entry together with its associated tags. Then rebuild your project. I have encountered this problem countless of times working in interface builder and by editing the xib the vast majority of the time I could solve this problem.
Interface Builder Potential Issue
 
 
Q