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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Paul Dunahoo](https://secure.gravatar.com/avatar/2ea99d11ef70416ea10b9a73187b12ad?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Paul Dunahoo
5,390 PointsCannot Pass Introduction to Arrays Code Challenge
NSArray *myArray = [[NSArray alloc] initWithObjects:@"Apple",@"Orange",@"Bannana",@"Plum", nil];
self.myLabel.text = [myArray objectAtIndex:0];
That's my code. The first line was completed, and marked as correct. However, when I do the second step and add the second line, it is marked as wrong. Any ideas to why that is?
4 Answers
![Amit Bijlani](https://uploads.teamtreehouse.com/production/profile-photos/5393/micro_NewProfile2.jpg)
Amit Bijlani
Treehouse Guest Teacher@Paul in the second line you are assigning the value returned from the myArray
to a label but in this case, it is non-existent. It exists in the context of the project but the Code Challenge does not test against variables or properties declared within the project. Hence, your answer [myArray objectAtIndex:0];
is perfect, just don't assign it to a label.
![Paul Dunahoo](https://secure.gravatar.com/avatar/2ea99d11ef70416ea10b9a73187b12ad?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Paul Dunahoo
5,390 PointsI think I should add that I feel the directions are not very clear for this section, as far as naming the label goes. It doesn't even say what I should call it.
![Leif Sandaas](https://secure.gravatar.com/avatar/2917665dd52a7fe2acc0b13d5c52976d?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Leif Sandaas
14,275 PointsThanks for the help Amit. I have a small question. In the code you taught us in the video the objectAtIndex number was in parens. Here is isn't. Does it make a difference?
Thanks
![Amit Bijlani](https://uploads.teamtreehouse.com/production/profile-photos/5393/micro_NewProfile2.jpg)
Amit Bijlani
Treehouse Guest Teacher@leif Not sure where you saw that can you please provide a link or paste in the code?