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 trialJacob McQueen
2,166 PointsI am receiving an error. But everything is typed exactly as I am shown . . .
Here is a screenshot of the error and my code. http://i.imgur.com/RgvBLGh.jpg
As you can see, I have declared the Method at the Bottom of the screen, but it says that It cannot find it. What is the problem?
4 Answers
Nick Kohrn
36,935 PointsYour method declaration is typed as rbgColor, while your implementation of the method is rgbColor.
Just change your method signature on line 40 to rgbColor.
Nick Kohrn
36,935 PointsA method signature is basically the declaration of the method. It's the name of the method, including the parameters and return type.
The method signature of your method from your attached image is this:
- (UIColor *) rgbColorFromDictionary: (NSDictionary *) colorDictionary;
Method signatures are the declarations that you put in your interface (.h) file when you let Xcode know that you will be implementing that method in your implementation (.m) file.
Jacob McQueen
2,166 PointsOk, I didn't even have this method in my .h file, so I copied and put it there, but I still get the same error. Can you explain what you think I should do?
Nick Kohrn
36,935 PointsCan you get a screenshot of the upper-part of your implementation (.m) file that you included in your initial post? I want to make sure that you are importing your Playlist.h file at the top of your implementation (.m) file.
Jacob McQueen
2,166 PointsOK here's my .m file: http://i.imgur.com/jfrssx2.jpg
and my .h file: http://i.imgur.com/LZ4L25T.jpg
Nick Kohrn
36,935 PointsThank you for posting the screenshots of your files.
It looks like you are creating a method signature of this in your interface (.h) file on line 14 and also correctly declaring it in your implementation (.m) file on line 40.
- (UIColor *) rbgColorFromDictionary: (NSDictionary *) colorDictionary;
However, when you are calling the method on line 35 of your implementation (.m) file, you are calling it with the incorrect method name.
Since you declared it as rbgColorFromDictionary, it will cause an error because you are calling it as rgbColorFromDictionary. You have switched 'rbg' in the method signature with 'rgb' when you call it. So, on line 40 of your implementation (.m) file, just change the 'rgb ' part of the method signature to 'rbg'. Or you can change 'rbg' to 'rgb' on line 14 of your interface (.h) file and on line 40 of your implementation (.m) file.
Jacob McQueen
2,166 PointsOk I changed the code here in the way I think you wanted, but I am still receiving the same error. http://i.imgur.com/DVkfeCU.jpg I tried with calling both rgb and rgbColor, but anything I type in that starts with "rg" is unrecognizable by Xcode.
Jacob McQueen
2,166 PointsJacob McQueen
2,166 Pointswhat is a method signature?