Done and Cancel buttons won't work after Delegates and Protocols chapter

I have been following along with iOS apprentice and at the end of chapter Delegates and Protocols, by done and Cancel buttons do not seem to work anymore, and I do not get any message in the debug pane. I compared the code to the final version for the chapter that comes with the book and it is identical, can someone offer some insight.

It’s difficult to see what might be going on by taking a look at select code snippets. If you can ZIP up your project, upload it somewhere and provide a link to it here, then I (or somebody else) can take a look and let you know what might be going on …

thanks for the reply! I posted it on my GitHub , Hopefully you can help out :slight_smile: !

Your buttons were connected correctly but your delegate in AddItemViewController was nil and so the delegate messages were not propagated back up to the delegate — and of course, nothing was happening at the delegate end.

If you check where the delegate for AddItemViewController is set, you’ll notice that this happens in ChecklistViewController in prepare(for:sender:). However, in order for that code to work correctly, you need to have the segue name set and the name referenced in your code has to be correct.

Did you check that?

I just checked, it seems I forgot to name the segue. Thank you so much for the help!

This topic was automatically closed after 166 days. New replies are no longer allowed.