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 trialHossam Khalifa
17,200 PointsWhy was the author first not the title?
NSDictionary *book = [[NSDictionary alloc]initWithObjectsAndKeys:@"The cat in the hat",@"title",@"Dr.Seuss",@"author" ,nil];
The Title is written first but the author shows up first when we build the app. Why?
6 Answers
Hossam Khalifa
17,200 PointsI think its alphabetical
Steve Hunter
57,712 PointsHow are the objects and keys called? The above code code sets the pairings but you call them in whichever order you like.
Post the code that displays the entries - I can't remember what it is!
Steve Hunter
57,712 PointsAh - you've just sent the whole *book to NSLog. I don't think an NSDictionary can be relied upon to output in any particular order, unlike the NSArray. Objects and keys are paired.
Hossam Khalifa
17,200 Pointsby key :D
Hossam Khalifa
17,200 Pointsby key :D
Hossam Khalifa
17,200 Pointsby key :D
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsBy key, or object? ;-)
You may well be right, yes.