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!

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 Build a Simple iPhone App (iOS7) Getting Started Assign String to a Label

IBAction Challenge

In a challenge for the "build an iPhone app" course, I'm being asked to "define a method called 'buttonPressed' and make sure it returns an 'IBAction'".

So, I typed the following: (IBAction) buttonPressed; and NSLong(@ "Button Pressed");

I think I put some curly braces in there too.

It didn't work. My error message just restated the directions. I'm not sure which part of what I just learned and practiced needs to be typed into the challenge box.

Thanks to anyone who takes time to help me.

Shawn McGrory
Shawn McGrory
546 Points

Try NSLog(@"Button Pressed"); instead of 'NSLong'!

At least Xcode catches typos!

2 Answers

Stone Preston
Stone Preston
42,016 Points

you were very close with your first answer. the challenge just wants you to define an empty method called buttonPressed that returns an IBAction. remember that instance method signatures start with a dash

#import "THViewController.h"

@implementation THViewController

// Add your code below
 - (IBAction)buttonPressed {




Thanks Shawn and Stone! I really appreciate your taking the time to answer.