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
Clovis Weisbart
2,591 PointsHELP: Adding Login and Sign Up Screens
I keep getting an error for all the different ways I tried to solve this challenge. I think it might be because I am not correctly understanding what is being asked of me. Could someone please give me some hints on how to solve this challenge:
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];
}
@end
Thank you
Fabio Floris
526 Points-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
sorry, this void is correct
6 Answers
Ben Jakuben
Treehouse TeacherThis task is just asking you to add the 'addSong' method to your file. You can add it below the end of 'viewDidLoad'. :)
Jon Harvell
3,870 PointsI've tried several different ways to add the method to the file, but I am getting it incorrect. Any hints?
-(IBAction)addSong:(id)sender; -(void)addSong:(id)sender;
Ben Jakuben
Treehouse TeacherYour first one is correct if we are wiring the addSong method to an IBAction, but we aren't in this example. We just need (void)addSong, which doesn't require the (id)sender parameter that you are also including.
John Carr
Courses Plus Student 1,984 PointsSpent about 2 hours looking at defining methods, even after checking this i could not figure where i was going wrong. Took a look back at Amits video on IBAction and it clicked what i had done wrong.
John Carr
Courses Plus Student 1,984 PointsWow i was just about to type here after about 2 hours of wondering what the heck i was doing wrong and sifting through numerous sites and apple docs on defining methods. Was about to give out to Ben haha, the answer lies within Ben's replies here. I am face palming my self here, lets just say i was 2 lines away from being right and wrong haha.
Clovis Weisbart
2,591 PointsHaha thanks! I got through it now...I stupidly misread the challenge
Andrej Kozuharov
2,404 PointsCould any additional help regarding this question be provided? Don't know where to start. I've tried -(IBAction): (void) addSong; But it doesn't work. I've tried several other options too but I just can not solve this problem.
Ben Jakuben
Treehouse TeacherHi Andrej,
Your format for the method definition is a bit off. Check out the examples in code in the video or maybe this blog post to understand methods better. That's an important concept to understand thoroughly, so I don't want to just provide the answer. :)
Zdeněk Zemek
4,430 Pointsi decided to finish this course... this is not for me... With Amit everything was OK. He learned something me from the video and after that I practically trained it in the challenge or in my xCode test project. But in this course is strange -sorry Ben. But WHY you are learning us something and after that You want since us something different in the challenge? It does not make sence to me. And at the seccond - you are speaking very quickly oposite of Amed. Maybe is it only my problem, because i am not from english speaking country. :-)
Best reg.
Ben Jakuben
Treehouse TeacherSorry to see you drop the course! It is an advanced course and is meant to be challenging, though everything you need for all the challenges is covered in the videos. Asking you to do it in a slightly different way is to improve your own learning, though. It's better if you can apply the concepts across more than one example.
And sorry if I'm speaking too quickly! You can always use the video playback controls to slow down (or speed up) any Treehouse video.
Hope you don't give up on iOS! We're here to help if you give it another go.
eric graf
5,538 PointsNot speaking for anyone else, but I WAY over-thought this one. Part misreading the challenge, part expecting something else.
Fabio Floris
526 PointsFabio Floris
526 PointsHonestly, I could not figure out what is the problem you're having. Having problems with the
- (void) prepareForSegue: (UIStoryboardSegue *) sender follows: (id) senderor by the action to save a given?