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

iOS Objective-C Basics (Retired) Foundation Framework NSDictionary

Vidit Shah
Vidit Shah
6,037 Points

Bummer!The year set is not the correct value

NSDictionary *album=@{@"title":@"Abbey Road",@"artist":@"The Beatles"}; NSMutableDictionary *albumMutable=[NSMutableDictionary dictionaryWithDictionary:album]; [albumMutable setObject:@1969 forKey:@"year"]; don't know what's wrong in the code

4 Answers

Stone Preston
Stone Preston
42,016 Points

year probably needs to be a string, not an NSNumber:

[albumMutable setObject:@"1969" forKey:@"year"];

below is your full code with the year changed to a string:

NSDictionary *album=@{@"title":@"Abbey Road",@"artist":@"The Beatles"}; 
NSMutableDictionary *albumMutable=[NSMutableDictionary dictionaryWithDictionary:album];
 [albumMutable setObject:@"1969" forKey:@"year"];
Vidit Shah
Vidit Shah
6,037 Points

Thank you so much Brother :)

Vidit Shah
Vidit Shah
6,037 Points

Thank you so m8ch Brother :)

What was the question for the problem?