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 Build a Playlist Browser with Objective-C Working With Multiple View Controllers Recap of iOS Basics

Shaun Kelly
Shaun Kelly
5,648 Points

My app crashes as soon as i press the button...

App crashes when i press the button and says in the log "unrecognized selector sent to instance"

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];



    [self.aButton setTitle:@"Press me!" forState:UIControlStateNormal];



}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)buttonPressed {

    self.view.backgroundColor = [UIColor orangeColor];
}




@end
Chris Jackson
Chris Jackson
30,535 Points

I'm having the same problem. My code is exactly the same. Has anyone found a solution?

3 Answers

You need to connect the function to the UIButton

delete the button then redo it again

I am also getting this error. I'm pretty sure I followed the video exactly. What do you mean "connect the function to the UIButton"?