Thread 1: signal SIGABRT for Checklist pg. 27

This strange message prevents the app from launching. A few threads suggest that there is a breakpoint issue. I am pretty sure I’ve ruled out that possibility, because there is no blue arrow in the gutter.

In the bottom right corner of the Xcode window is the Debug output pane. There should be an error message in there. What does this message say (the entire thing)?

1 Like

Whenever I get this error the problem is anywhere but in AppDelegate. If you keep on clicking continue the debugger will probably eventually spit out some error messages that tell you a lot more about where the problem is and that will give you a hint about where you can start looking (or give us some more information).

Additionally make sure you have an exception breakpoint active in your project. I don’t think it will help you in this case but it is just as well to have it for the times that it does catch an exception.

1 Like

Assuming the debug window is this one below…

Hollance, the error reads the following:

2016-06-20 19:59:24.728 Checklists[638:6043] *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITableView.m:6573
2016-06-20 19:59:24.733 Checklists[638:6043] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘unable to dequeue a cell with identifier ChecklistItem - must register a nib or a class for the identifier or connect a prototype cell in a storyboard’
*** First throw call stack:
(
0 CoreFoundation 0x000000010ba5bd85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d7ffdeb objc_exception_throw + 48
2 CoreFoundation 0x000000010ba5bbea +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010beacd5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 UIKit 0x000000010c3cdef5 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 266
5 Checklists 0x000000010b876354 _TFC10Checklists23ChecklistViewController9tableViewfTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 116
6 Checklists 0x000000010b87687f _TToFC10Checklists23ChecklistViewController9tableViewfTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 79
7 UIKit 0x000000010c3e14f4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 766
8 UIKit 0x000000010c3e162c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
9 UIKit 0x000000010c3b5d4f -[UITableView _updateVisibleCellsNow:isRecursive:] + 2996
10 UIKit 0x000000010c3ea686 -[UITableView _performWithCachedTraitCollection:] + 92
11 UIKit 0x000000010c3d1344 -[UITableView layoutSubviews] + 224
12 UIKit 0x000000010c33e980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
13 QuartzCore 0x0000000110d09c00 -[CALayer layoutSublayers] + 146
14 QuartzCore 0x0000000110cfe08e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
15 QuartzCore 0x0000000110cfdf0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
16 QuartzCore 0x0000000110cf23c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
17 QuartzCore 0x0000000110d20086 _ZN2CA11Transaction6commitEv + 486
18 QuartzCore 0x0000000110d207f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
19 CoreFoundation 0x000000010b980c37 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
20 CoreFoundation 0x000000010b980ba7 __CFRunLoopDoObservers + 391
21 CoreFoundation 0x000000010b97611c CFRunLoopRunSpecific + 524
22 UIKit 0x000000010c27ef21 -[UIApplication _run] + 402
23 UIKit 0x000000010c283f09 UIApplicationMain + 171
24 Checklists 0x000000010b8774c2 main + 114
25 libdyld.dylib 0x000000010e2c392d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

Same problem for me, same error message.

The error message says:

'unable to dequeue a cell with identifier ChecklistItem - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

That’s your answer right there. You did not set the Identifier on the prototype cell in the storyboard or it is not spelled exactly the same as ChecklistItem.

2 Likes

Here’s where you have to do it:

1 Like

Solved! I changed the identifier from Checklistitem to ChecklistItem just as you prescribed. Thanks for showing the location of that Identifier field box @aeberbach.

An new error showed up after I fixed the one above.

This time, the debug console says:

Could not cast value of type ‘UITableViewCell’ (0x10d142540) to ‘UILabel’ (0x10d13ef80).
(lldb)

I’m not quite sure how to approach this one. Should I begin looking at my code on the ChecklistViewController.swift file or Main.storyboard? The code for ChecklistViewController is posted below

import UIKit

class ChecklistViewController: UITableViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 1
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("ChecklistItem", forIndexPath: indexPath)
    
    let label = cell.viewWithTag(1000) as! UILabel
    
    if indexPath.row == 0 {
        label.text = "walk the dog"
    } else if indexPath.row == 1 {
        label.text = "brush my teeth"
    } else if indexPath.row == 2 {
        label.text = "Learn iOS Development"
    } else if indexPath.row == 3 {
        label.text = "Soccer practice"
    } else if indexPath.row == 4 {
        label.text = "Eat ice cream"
    }
    
    return cell 
}

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    
    if let cell = tableView.cellForRowAtIndexPath(indexPath) {
        if cell.accessoryType == .None {
            cell.accessoryType = .Checkmark
        } else {
            cell.accessoryType = .None
        }
    }
    
    tableView.deselectRowAtIndexPath(indexPath, animated: true)
}

}

That new error means you put the tag 1000 on the cell instead of the label (or on both).

1 Like

Thanks, I mistakenly changed the Tag Amount on the Checklist instead of the Table View in storyboard.

With no surprise, I got another error message below.

fatal error: unexpectedly found nil while unwrapping an Optional value

I assume the error is from the storyboard again because I’ve copied and pasted most of the code from the Ray’s solutions.

Did you set the tag on the Label in the storyboard?

1 Like

You’re absolutely right. I changed the Tag on the Label to 1000 as well. Below is what I did.

For Errors like this, I tend to (roughly) use the following:

Exc_Bad_Instruction or SIGABRT: Read the error message

App Delegate Crash: Use breakpoints to figure out where the error is coming from

Exc_Bad_Access: You’ve got a memory management issue…

So this error: 2016-06-20 19:59:24.733 Checklists[638:6043] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ’

unable to dequeue a cell with identifier ChecklistItem - must register a nib or a class for the identifier or connect a prototype cell in a storyboard’

tells me that my cell with identifier ChecklistItem don’t know what to do… :wink:

Make sure you’ve spelled “ChecklistItem” with an upper case “I” for “Item”
The Table View Cell Identifier, (in the prototype cell Attribute Inspector), should be spelled identically to the way it’s spelled in “cellForRowAt”:
let cell = tableView.dequeueReusableCell(withIdentifier: “ChecklistItem”, for: indexPath)

The mistake I initially made was because the figure in the tutorial looks like the “I” for “Item” in “ChecklistItem” is lower case and that’s what I entered.