SHARE
TWEET

signal SIGABRT for tableView

lachlanwm Sep 17th, 2019 (edited) 121 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @UIApplicationMain
  2. class AppDelegate: UIResponder, UIApplicationDelegate {  = Thread 1: signal SIGABRT
  3.  
  4. 2019-09-18 14:25:48.762695+1000 ShirleysCookbook0[672:14571] *** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3698.93.8/UITableView.m:8054
  5. 2019-09-18 14:25:48.771748+1000 ShirleysCookbook0[672:14571] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier RecipeStepsCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
  6.  
  7. Stackoverflow etc all suggest the MainStoryboard does not have the cell identifier RecipeStepsCell (but it has).  As mentioned, it was working, but now its is terminating
  8.  
  9.  
  10. // 13a Add in the UITableViewDataSource
  11. extension RecipeViewController: UITableViewDataSource {
  12.    
  13.     // 13b Add in the numberOfRowsInSection
  14.     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  15.        
  16.         // 13c Return the number of steps
  17.         return recipeStep.count
  18.     }
  19.    
  20.     // 13d Add in the cellForRowAt
  21.     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  22.        
  23.         // 13e Get a cell
  24.         // Add a guard/else, and change unwrap as! to optional as?
  25.         // let cell = tableView.dequeueReusableCell(withIdentifier: "RecipeStepsCell", for: indexPath) as! RecipeStepsCell
  26.         guard let cell = tableView.dequeueReusableCell(withIdentifier: "RecipeStepsCell", for: indexPath) as? RecipeStepsCell
  27.             else {
  28.                 fatalError("Wrong cell class dequeued")
  29.         }
  30.        
  31.         // 13f Get recipeSteps that the tableview is trying to display
  32.         let step = recipeStep[indexPath.row]
  33.        
  34.         // 13g  For the cell at row get the steps
  35.         // 14i: Having created RecipeStepCell and add in the necessary method displaySteps, for the cell at row get the steps
  36.         cell.displaySteps(step)
  37.        
  38.         // 13h Return that cell
  39.         return cell
  40.        
  41.     }
  42.  
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top