Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Predict button Doesn't Work

I've been on this forum trying to find an answer to my problem and I haven't found a solution. I'm following the code in the videos exactly in section 1 of building the crystal ball app yet my predict button does nothing when it is clicked. Here is my code:

https://www.dropbox.com/s/l0c5xz8nsmp04vf/2014-07-06%2013.52.16.jpg

What do I do? Should I just start over from the beginning? I'd rather not but it's not worth my time to spend days on this project and not have a working app. Thank you.

5 Answers

I definitely wouldn't start again from scratch. Personally, when I've been forced to slog it out for a few hours in frustration I ended up learning from mistakes and avoiding them later.

As far as your code, it looks like it should be working correctly. I would try making sure the "buttonPressed" method is connected to the interface button correctly, as a broken connection would cause nothing to happen when the button is pressed. Make sure when connecting the button you select, "TouchUpInside." Let me know if this works!

How would I check if the buttonPressed method is connected to the interface button? That might be my problem.

From your 'THViewController.h' file, click the circle to the left of your code line (it looks like yours is line 13). An option to select 'Mainstoryboard.storyboard' should appear, click it and it'll take you to the storyboard view. From here, ctrl+click (or right-click) your button, under 'Sent Events' there should be an option 'Touch Up Inside" and the circle should be filled in.

Any luck?

Yep. The app at this stage works perfectly. Thank you for your help!