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 Build a Blog Reader iPhone App Exploring the Master-Detail Template Modifying the Master-Detail Template

Exploring the Master-Detail Template

Challenge #1

Create an array named 'booksArray' with the following book titles: 'Hamlet', 'King Lear', 'Othello', 'Macbeth'.

Here's my code:

self.booksArray = [NSArray arrayWithObjects:@"Hamlet"; @"King Lear"; @"Othello", @"Macbeth", nil];

4 Answers

Eric Hodgins
Eric Hodgins
29,207 Points

Is there a booksArray property already defined? If not you'll have to make one. Try:

NSArray *booksArray = [NSArray arrayWithObjects:@"Hamlet", @"King Lear", @"Othello", @"Macbeth", nil];

Eric Hodgins
Eric Hodgins
29,207 Points

Use just comma's instead of semi-colons to separate the objects.

self.booksArray = [NSArray arrayWithObjects:@"Hamlet", @"King Lear", @"Othello", @"Macbeth", nil];

Bummer! Make sure you created an array with the correct variable name, and check your syntax!

Challenge # 2:

Create a string variable called 'bookTitle' and assign it the third item from the 'booksArray'.

My code:

NSString *bookTitle = @"Othello";

Result:

Bummer! The method for finding an object in an array at a given index was not called.

Help! This is driving me nuts! Challenge is nowhere in the previous video :(