title: App Crashes. Trying to debug [UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
body: <p>I am using 4 container view and have 4 tableview for each container view. But in the strange thing is some devices getting crashes not all devices. I am getting crashes/Log in Firebase Crashlytics.</p>
  <pre><code>Crashed: com.apple.main-thread
  0  PuzzleStar                     0x1d5cf8 threeXtwoVC.tableView(_:cellForRowAt:) + 4309310712 (threeXtwoVC.swift:4309310712)
  1  PuzzleStar                     0x1d61bc @objc threeXtwoVC.tableView(_:cellForRowAt:) + 4309311932 (&lt;compiler-generated&gt;:4309311932)
  2  UIKitCore                      0xd42648 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 724
  3  UIKitCore                      0xd100c8 -[UITableView _updateVisibleCellsNow:] + 2524
  4  UIKitCore                      0xd232ec -[UITableView _visibleCellsUsingPresentationValues:] + 448
  5  PuzzleStar                     0x1d6458 threeXtwoVC.scrollViewDidScroll(_:) + 563 (threeXtwoVC.swift:563)
  6  PuzzleStar                     0x1d69e8 @objc threeXtwoVC.scrollViewDidScroll(_:) + 4309314024 (&lt;compiler-generated&gt;:4309314024)
  7  UIKitCore                      0xfc6a5c -[UIScrollView _notifyDidScroll] + 76
  8  UIKit                          0x6d968 -[UIScrollViewAccessibility _notifyDidScroll] + 44
  9  UIKitCore                      0xd10c68 -[UITableView _notifyDidScroll] + 60
  10 UIKitCore                      0xfaea88 -[UIScrollView setContentOffset:] + 1160
  11 UIKitCore                      0xd2fab8 -[UITableView setContentOffset:] + 284
  12 UIKitCore                      0xfbfc14 -[UIScrollView _smoothScrollWithUpdateTime:] + 2320
  13 UIKitCore                      0xfbfed4 -[UIScrollView _smoothScrollDisplayLink:] + 436
  14 QuartzCore                     0x13640 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 660
  15 IOKit                          0x7464 IODispatchCalloutFromCFMessage + 376
  16 CoreFoundation                 0x77b54 __CFMachPortPerform + 172
  17 CoreFoundation                 0x9b420 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
  18 CoreFoundation                 0x9a834 __CFRunLoopDoSource1 + 588
  19 CoreFoundation                 0x949f4 __CFRunLoopRun + 2332
  20 CoreFoundation                 0x93ba0 CFRunLoopRunSpecific + 572
  21 GraphicsServices               0x3598 GSEventRunModal + 160
  22 UIKitCore                      0xb2e2f4 -[UIApplication _run] + 1052
  23 UIKitCore                      0xb33874 UIApplicationMain + 164
  24 PuzzleStar                     0x53c8 main + 26 (HBText.swift:26)
  25 libdyld.dylib                  0x1568 start + 4 
  </code></pre>
  <p>I used this code for tableview</p>
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          
          if isShowAds &amp;&amp; ((indexPath.row + 1) == arrCategories.count) &amp;&amp; !(UserDefaults.standard.object(forKey: &quot;isProUser&quot;) as? Bool ?? false) {
              
              guard let adsCell = tableView.dequeueReusableCell(withIdentifier: &quot;BottomAds&quot;, for: indexPath) as? BottomAdsView else {
                  return UITableViewCell()
              }
              
              if !adsCell.adLoad {
                  DispatchQueue.main.async {
                      adsCell.setupAdsUI()
                  }
              }
              
              return adsCell
              
          }
          else if (!(UserDefaults.standard.object(forKey: &quot;isProUser&quot;) as? Bool ?? false) &amp;&amp; (indexPath.row &gt; 4)) &amp;&amp; arrCategories.count &gt; 6 &amp;&amp; (arrCategories[indexPath.row].id == arrCategories[5].id) {
             
             guard let adsCell = tableView.dequeueReusableCell(withIdentifier: &quot;BottomAds&quot;, for: indexPath) as? BottomAdsView else {
                 return UITableViewCell()
             }
             
             if !adsCell.adLoad {
                 DispatchQueue.main.async {
                     adsCell.setupAdsUI()
                 }
             }
             
             return adsCell
         }
          else if (!(UserDefaults.standard.object(forKey: &quot;isProUser&quot;) as? Bool ?? false) &amp;&amp; (indexPath.row &gt; 15)) &amp;&amp; arrCategories.count &gt; 16 &amp;&amp; ( arrCategories[indexPath.row].id == arrCategories[16].id) {
              guard let adsCell = tableView.dequeueReusableCell(withIdentifier: &quot;BottomAds&quot;, for: indexPath) as? BottomAdsView else {
                  return UITableViewCell()
              }
              
              if !adsCell.adLoad {
                  DispatchQueue.main.async {
                      adsCell.setupAdsUI()
                  }
              }
              
              return adsCell
          }
          
         else {
             
             guard let cell = tableView.dequeueReusableCell(withIdentifier: &quot;threeXfour&quot;, for: indexPath) as? threeXfourCell else {
                 return UITableViewCell()
             }
             
             cell.cellTapped = {
                 if !self.isFromDB {
                     self.delegate?.threefourCellTapped(cardDataModel: self.arrCategories[indexPath.row], cellIndex: indexPath.row)
                 }
             }
             
             if arrCategories.count &gt; 0 {
                 
                 cell.configthreefourCell = arrCategories[indexPath.row]
                 cell.imageLoaded = {
                     DispatchQueue.main.async {
                         if cell.imgBack != nil &amp;&amp; cell.imgBack.image != nil {
                             let aspectRatio = cell.imgBack.image!.size.height/cell.imgBack.image!.size.width
                             let imageHeight = cell.vwBack.frame.width*aspectRatio
                             rowHeightsAspected[indexPath.row] = aspectRatio
                             //                        self.tblThreeFour.beginUpdates()
                             self.defaultHeight = imageHeight+17.0
                             self.rowHeights[indexPath.row] = imageHeight+17.0
                             //                        self.tblThreeFour.endUpdates()
                             //                        self.tblThreeFour.layoutIfNeeded()
                         }
                     }
                 }
                 
                 //Adding tag and handle click event for Preview &amp; Favourite
                 cell.btnPreview.tag = indexPath.row
                 cell.btnPreview.addTarget(self, action: #selector(onClickPreview), for: .touchUpInside)
                 
                 cell.btnFav.tag = indexPath.row
                 cell.btnFav.addTarget(self, action: #selector(onClickFav), for: .touchUpInside)
                 
                 if !cardFavExists(fileName: arrCategories[indexPath.row].zipFile.name, entitiName: puzzlestartDB.entitynameFavourite) {
                     cell.btnFav.setImage(UIImage.init(named: &quot;ic_fav&quot;), for: .normal)
                 }
                 else {
                     cell.btnFav.setImage(UIImage.init(named: &quot;ic_fav_fill&quot;), for: .normal)
                 }
             }
             tblThreeFour.clipsToBounds = false
             return cell
         }
      }
  </code></pre>