Checklists (V5): Cancel on "Add Checklist" adds item; Done adds it twice

This is happening upon “Run the app” on pg. 168.

This smells like a classic rookie error–probably in Interface Builder–but I can’t find it.

Stepping through the code, I can see that the done() method in ListDetailViewController get called twice when Done is pressed, and I can also see it get called when Cancel is pressed.

This picture shows my connections to the Done button.

Beyond this particular gaffe, I feel like I am missing a fundamental debugging technique for this world.

Thanks in advance for your sage advice.

I just figured it out. When I was trying to remember how to “Connect the text field’s Did End on Exit event to the done action on the view controller” as instructed on pg. 165, I did a CNTRL-click drag from the Text Field control to the “done()” method in the Assistant Editor window.

Here is the result:

This made a connection from the Text Field to “Editing Did End” event, which apparently bypass our whole Cancel logic (in addition to saving twice upon Done).

Removing this fixes my problem. Re-doing my ill-fated click-drag makes the problem come back.

(Now … if I just really grokked these UI events, this might be a bit easier.)

Glad you figured it out.

Only Did End On Exit needs to be connected to done(). If that is connected, you’re good to go. :slight_smile:

Apart from that inspector (that you obviously found) you can right-click on the objects themselves to display all connections and you have the option to remove them, also by clicking the ‘x’. This is by far my most common source of crashes, controls with connection to outlets that have been removed.