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

Initializing with Dictionary

I had a typo last time so that was the problem, but now at the second part of challenge this is what is happening. I'm supposed to initialize an NSMutableDictionary with the values from the first:

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

NSMutableDictionary *albumMutable = [[NSMutableDictionary alloc] initWithDictionary:album];

But i get an error, so what is the correct way??

2 Answers

Thanks yes i solved it! i was referring to the video lessons so i had to look for dictionaryWithDictionary to do so, but thanks a lot Preston!

Stone Preston
Stone Preston
42,016 Points

your code looks correct, however try using the NSMutableDictionary dictionaryWithDictionary convenience constructor instead of using alloc/initWithDictionary. I think the challenge may be expecting you to use the convenience constructor.