Welcome to the Treehouse Community
Looking to learn something new?
iOS 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:
This is later explained in the beginning of the next video after the quiz.
Ben JakubenTreehouse Teacher
That 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!
I 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?
I 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;