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

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

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

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.

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

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"

you're right, thank you for the clarification!