Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Michael Cooke
211 PointsiOS Development - Build a Simple iPhone App Quiz/Test Order Incorrect
The video "Getting to Know Arrays" doesn't explain how the method of finding the length of an array in Objective-C:
[arrayName count];
This is later explained in the beginning of the next video after the quiz.
3 Answers

Ben Jakuben
Treehouse TeacherThat was by design, actually. :) Amit wanted to encourage students to figure out the correct method by using the documentation or playing around in Xcode. We get a fair amount of questions about this code challenge, though!

Michael Cooke
211 PointsI was wondering if that was a possibility... how dubious. >:)
I actually went back a few minutes ago and entered this in:
NSArray *myArray = [[NSArray alloc] initWithObjects:
@"Apple",
@"Orange",
@"Banana",
@"Plums", nil];
NSString *arrayAccessString = [myArray objectAtIndex:0];
NSString *arrayLength = [myArray count];
...and it doesn't want to seem to work. I am at a loss with this test, because I'm getting a static error message reading "Bummer! No the method is not called 'length'..." which is assuming that the user is trying to do:
NSString *arrayLength = [myArray length];
After digging around in cumbersome documentation, I'm at a loss. Any pointers?

Michael Cooke
211 PointsI got it:
NSLog (@"Number of elements in array = %f", [myArray count]);
I'm kinda in a epiphany caused personal crisis because of these format specifiers... I've been spoiled far too long with C++'s
cout << variable << endl;
:'(