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

Challenge task 3 of 3 Let's add the year of the album to the 'albumMutable' variable. Where the key is a NSString 'year' and the value is also a NSString '1969'.

Seems like this should be the answer

NSDictionary *album = @{ @"title":@"Abbey Road", @"artist":@"The Beatles" }; NSLog(@"album %@", album);

NSMutableDictionary *albumMutable = [NSMutableDictionary dictionaryWithDictionary:album]; [albumMutable setObject:@1969 forKey:@"year"]; NSLog(@"%@", albumMutable);

4 Answers

Trey Chad
Trey Chad
3,535 Points

I had the same issue. Stone is right, 1969 needs to be a string, and you have it declared as an integer.

So the line of code should be:

[albumMutable setObject:@"1969" .... instead of [albumMutable setObject:@1969

Stone Preston
Stone Preston
42,016 Points

Is it possible it wants the year as a string not an integer?

Liam Herbert
Liam Herbert
15,140 Points

Hello,

I was stuck with the same problem I had the code as: setObject:@1969

Then I tried it as: setObject:@"1969"

And Booya! It worked.

Matteo Giuzzi
Matteo Giuzzi
1,913 Points

But can't you fix this? The right answer should be @1969 and not @"1969"....

Stone Preston
Stone Preston
42,016 Points

well the challenge says "Where the key is a NSString 'year' and the value is also a NSString '1969'." It tells you it needs to be a string. So the right answer is @"1969"

Matteo Giuzzi
Matteo Giuzzi
1,913 Points

you're right, thank you for the clarification!