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 trialZenek Barburka
7,009 Pointscode fine in Xcode but not in challange
I am not sure what's wrong with it, Xcode compiles it just fine
NSMutableDictionary *carDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Make",@"Honda",@"Model",@"Accord",nil];
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! You're correct, your code compiles just fine, but it's not giving the keys and value pairs they are expecting. Essentially, you have your keys and values backward. First we say the value and then the key. I know this may seem a little backwards especially if you are used to other programming languages. For example, you have the value "Make" at the key "Honda". But we want the value "Honda" at the key "Make".
Take a look:
NSMutableDictionary *carDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Honda",@"Make",@"Accord",@"Model",nil];
Here we we have the value of "Honda" at the key "Make" and the value of "Accord" at the key "Model".
Hope this helps!
Zenek Barburka
7,009 Pointssilly me :-) thank you