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

Need help with Getting to know Arrays Task part 2

I'm stuck on the following:

Access the first fruit in your array.

NSArray *myArray = [NSArray alloc]; myArray = [myArray initWithObjects: @"Apple",@"Orange",@"Banana",@"Plum", nil];

myArray = [myArray objetAtIndex:0];

3 Answers

myArray = [myArray objetAtIndex:0];

maybe it's just a typing error? objet instead of object

Thanks it worked. I have too be more careful on the spelling.

Deleted User

You got through the challenge but your solution is incorrect. You're assigning a pointer to the @"apple" string to the myArray variable. If you try to send subsequent messages to myArray that are NSArray* specific you'll crash at runtime due to Objective-C's dynamic typing system.