Chapter 3 Page 70- Cannot click on the "Hit Me" button

In the end of chapter 3, I changed my code following the book, and I’m able to run the program. However, whenever I click on the “Hit Me” button, the program stops, and lead me back to Xcode with this showing:


Why is this happening?

You notice the blue arrow on the Xcode editor window gutter on line 25? That’s a breakpoint - when you run code in debug mode (which is what you generally do when you run from Xcode), your code will stop on breakpoints. So that’s why your code stops there. If you click on the blue arrow, it will become a faded arrow - indicating that it is not active. After that, if you run your app, your code should not stop - at least on that breakpoint :slight_smile: If you have other breakpoints though, the same thing will happen with those …

Thank you! I figured it out and I’m able to run it now!!
I have another question though on page 80 chapter 4:joy:
it says in the book that the value shows up should be different, but mine is not changing.

Run the app and immediately press the Hit Me! button. It correctly says: “The value of the slider is: 50”. Stop the app, go into Interface Builder and change the initial value of the slider to something else, say, 25. Run the app again and press the button. The alert should read 25 now.

52%20PM

Here is my code, and my stimulator after I changed my currentValue to 75.

You changed the value in code, but if you notice, the book says to change the value in “Interface Builder” :slight_smile: So you must change the value in the storyboard since the viewDidLoad method loads the value of the slider at the time of the screen loading …

ohhh okay. Thank you :grinning:

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