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

Who's wrong?

Well I tried to NSDictionary *album=@{@"title":@"Abbey road",@"artist":@"The Beatles"}; (should be on one line) but The CodeChallenge engine says I have an error in my code:"your dictionary, album, doesn't contain a value". I was talking about the Objective-C basics->Foundation Framework->code NSDictionary (last code challenge)->first sub exercise, in the IPad App. (Sorry in advance, if I haven't been clear enough)

I also have tried: NSDictionary *album=[[NSDictionary alloc] initWithObjectAndKeys:@"Abbey Road",@"title",@"The Beatles",@"artist",nil]; But I get the same error prompted every time.

2 Answers

Gareth Borcherds
Gareth Borcherds
9,372 Points

I don't know about the second piece of code, but the first one is technically correct, you just didn't capitalize Road in Abbey Road.

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

The above passes the challenge and what you put fails.

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

The challenges are case sensitive.

Thanks a lot! :)

Gareth Borcherds
Gareth Borcherds
9,372 Points

The second one is incorrect because initWithObjectAndKeys should be initWithObjectsAndKeys. You forgot the s on Objects.