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 trialnemanjasreckovic
8,784 PointsObjective-C Basics, Code Challenge NSDictionary
I got error "The year set is not the correct value."
this is the code
NSDictionary *album = @{ @"title":@"Abbey Road", @"artist":@"The Beatles" };
NSMutableDictionary *albumMutable = [NSMutableDictionary dictionaryWithDictionary:album];
[albumMutable setObject:@1969 forKey:@"year"];
I guess someone miss-typed a year? Douglass Turner thanks!
6 Answers
Holger Liesegang
50,595 PointsDoes using setObject:@"1969" get you past? (yeah I know that @1969 for a NSNumer is totally ok :-) )
Douglass Turner
Treehouse Guest TeacherGuys,
@"123" is an NSString literal. @123 is an NSNumber literal.
Either can be used as key/value.
Douglass Turner
Treehouse Guest Teacher[albumMutable setObject:@1969 forKey:@"year"] can be rewritten as:
[album setObject:[NSNumber numberWithInteger:1969 forKey:@"year"]];
try that
Douglass Turner
Treehouse Guest Teacherstet: albumMutable instead of album
Danielle Quevedo
17,935 PointsPutting "1969" in quotes is the only way to go. The instructions say "...and the value is also a NSString '1969' ", so that's why leaving it as an integer (outside of quotes) won't work.
Nathan LaBarbera
7,748 PointsRight, with the quotation marks the challenge went through successfully for me. :@"1969" is what needed to happen.
Ben Jakuben
Treehouse TeacherBen Jakuben
Treehouse TeacherI believe this is a bug in this code challenge that has been logged and should be fixed shortly. As Holger suggested, try @"1969". :)
nemanjasreckovic
8,784 Pointsnemanjasreckovic
8,784 Pointsyap, that worked, thanks guys!
Sean Sassenrath
1,950 PointsSean Sassenrath
1,950 PointsStill broken.