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 trialJimmy Boone
8,940 PointsWhy am I told my Dictionary does not contain any values?
I have copied the format from the video exactly and I am still getting a "Your Dictionary doesn't contain any values error"
NSDictionary *album = @{@"title":@"Abby Road", @"artist":@"The Beatles"};
2 Answers
Naomi Freeman
Treehouse Guest TeacherNSDictionary *album = @{@"title":@"Abbey Road",@"artist":@"The Beatles"};
Hmmm, this ^ works. Stared at a for a couple minutes. I think you're just missing the e in Abbey Road. I could be wrong. It's throwing a funny error for that, but eh - give it a shot :)
Stone Preston
42,016 Pointsthe challenge may not like your use of the literal syntax. try using initWithObjectsAndKeys:
NSDictionary *album = [[NSDictionary alloc] initWithObjectsAndKeys:@"Abbey Road", @"title", @"The Beatles", @"artist", nil];
Dave Abalos
6,976 Pointsthis will work but is this part of the scope on his module? I'm afraid he will get confused... just saying.. :)
Stone Preston
42,016 Pointsyes it is indeed part of the scope of this module. see 1:35 of this video.
Doug uses the init with objects and keys method, not a literal. literals (besides string literal) are actually not part of the scope of this course, which is why I thought the challenge may not have accepted his literal syntax.
Dave Abalos
6,976 Pointsohh yeah.. thanks for the refresh... :)
Naomi Freeman
Treehouse Guest TeacherNaomi Freeman
Treehouse Guest TeacherWhile we're all here - any idea why my code has stopped being colourful when I post?
Stone Preston
42,016 PointsStone Preston
42,016 Pointsadd a language after the 3rd back tick. you can use c or objective c:
```objective-c
Naomi Freeman
Treehouse Guest TeacherNaomi Freeman
Treehouse Guest TeacherThanks :) New features eh? lol