iOS apprentice chapter 11 Done and Cancel buttons issue

I have been following the tutorial correctly however, at the end of chapter 11 navigation controllers where it says to run the app at the end of the chapter, if I click cancel nothing happens and if I click done it produces a bug that does not do anything and just opens Xcode, I checked with the code itself (tried to copy paste from the version in the book ) and that did not solve the issue so I’m guessing it is something in the storyboard… is anyone else having this issue? maybe something was missing in the storyboard?

Given that there isn’t enough detail to see what is going on, it’s hard to say what might be going wrong :slight_smile: When you see an error message in Xcode, providing a screenshot, or at least the text of the error message is helpful.

The code (and instructions) from the book work correctly with the latest Xcode (9.4) as far as I’m aware. Which version of Xcode are you using?

I’d suggest zipping up your project, uploading it somewhere online and then providing a link here so that I (or somebody else) can take a look and see what might be going on with your project.

(Based on the limited information)… It sounds like you have a button in your Storyboard file that isn’t linked up properly.

That is… When you press it, it tries to call a function that doesn’t exist anymore and is crashing the app.

I would check your outlets to make sure only the proper functions are there. Here’s an example of what I’m talking about:
image

I haven’t looked at that specific example you’re referring to, so I can’t speak to it directly… but I can say that this is a super common issue, so you’re not alone. Usually a crash (or so it sounds like) happens when there’s a reference to something that doesn’t exist, and it tries to access memory that isn’t allocated (that’s nerd speak for: your program tried to send a value to an object that doesn’t exist).

The best way to solve it is to check that all of your code and storyboard stuff is linked up properly so that it doesn’t call into excess (or old) things. Storyboards have a way of getting… outdated… so that’s a good place to check.

If you can post code examples, screenshots, or anything else, we can be much more helpful that way! :slight_smile:

Also I’ve created a quick video that covers other common swift mistakes and how to overcome them here: www.mypersonalcompass.com/swift-mistakes

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