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 trialRomesh Singhabahu
1,195 PointsHelp answer
Hi,
can someone give the answer to this statement...I wrote in my opion write but it gives me error...
thanks romesh
Romesh Singhabahu
1,195 PointsHi Stone,
thanks for the answer...the chellenge ask: Create an array named 'booksArray' with the following book titles: 'Hamlet', 'King Lear', 'Othello', 'Macbeth'.
then i wrote this:
self.booksArray = [NSArray arrayWithObjects:@"Hamlet", @"King Lear", @"Othello", @"Macbeth", nil];
but doesn't work gives me error...
thanks...
3 Answers
Gareth Borcherds
9,372 Pointsself.booksArray would only work if you had already created the property in your header file for booksArray. Since it doesn't you need create the pointer to booksArray and the initialize it. So it would look like:
NSArray *booksArray = [NSArray arrayWithObjects:@"Hamlet", @"King Lear", @"Othello", @"Macbeth", nil];
Romesh Singhabahu
1,195 PointsThanks for the answer...as I followed again the video it says to set the property on the header file and then initialized on implementation file but can't really understand how this challenge works...Can you give me the answer so I understand how it works?sorry I am new be and dummy,,,,
:(
Gareth Borcherds
9,372 PointsSame challenge or a different one? You might want to go back and complete the intro to C course to help you get a better understanding of all of these concepts. They are crucial to understand.
Romesh Singhabahu
1,195 PointsNo Gareth, the challenge number 1 of the Build a Blog Reader Iphone App... I need just a hint to understand how it works...
Gareth Borcherds
9,372 Pointsthe full set of answers to this challenge is
NSArray *booksArray = [NSArray arrayWithObjects:@"Hamlet", @"King Lear", @"Othello", @"Macbeth", nil];
NSString *bookTitle = [booksArray objectAtIndex:2];
[bookTitle uppercaseString];
Romesh Singhabahu
1,195 PointsThanks a lot....
Best
Romesh
Romesh Singhabahu
1,195 PointsHi Stone,
thanks for the answer...the chellenge ask: Create an array named 'booksArray' with the following book titles: 'Hamlet', 'King Lear', 'Othello', 'Macbeth'.
then i wrote this:
self.booksArray = [NSArray arrayWithObjects:@"Hamlet", @"King Lear", @"Othello", @"Macbeth", nil];
but doesn't work gives me error...
thanks...
Stone Preston
42,016 Pointsthe reason its not workng is because you need to create a new NSArray object, and not use a property. try
NSArray *booksArray = [NSArray arrayWithObjects:@"Hamlet", @"King Lear", @"Othello", @"Macbeth", nil];
Romesh Singhabahu
1,195 PointsOk...now I try...
thanks
Stone Preston
42,016 PointsStone Preston
42,016 Pointscan you please post your code