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


Code Challenge: Adding Login and Sign Up Screens

Hi, I could really use some help with this one.

In the view controller below about songs, tapping on a button to add a new song needs to perform a segue to another view controller. The button is wired up to an IBAction with the signature '- (void)addSong'. Start by defining this method.

#import "MusicViewController.h"

@implementation MusicViewController

- (void)viewDidLoad {
    [super viewDidLoad];

- (IBAction)addSong:(id)sender {


That's all I got.

1 Answer

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

The method signature is provided in the question. So you should define it exactly as mentioned: - (void)addSong.

Hi Amit,

Thanks for replying. I'm still having difficultly with this one.

import "MusicViewController.h"

@implementation MusicViewController Hey Amit, thanks for the reply. I'm still struggling with this. I know I need to tell it to perform a segue right?

  • (void)viewDidLoad { [super viewDidLoad];

  • (void)addSong:(id)sender { } }


Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

You cannot define one method inside another. The addSong is a separate method definition which means it's outside the curly braces of the viewDidLoad method. Also the method definition does not take an argument sender. It is simply-(void)addSong`.