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

Code Challenge: Create an NSMutableArray object called 'elements'.

The challenge is asking to to Create an NSMutableArray object called 'elements'.

I tried to create an NSMutableArray object by typing this into the editor: NSMutableArray *elements;

The code challenge editor says I made a mistake, but the code works just fine in Xcode.

Does anyone have any idea what went wrong?

Thanks.

2 Answers

Stefan Bjornsson
Stefan Bjornsson
3,362 Points

For the first task I have tried the 3 following lines of code that does not pass: NSMutableArray *elements; NSMutableArray *elements = [[NSMutableArray alloc] init]; NSMutableArray *elements = [[NSMutableArray alloc] initWithCapacity: 0];

When pushing the preview button I rarely see any display of errors through out this course it usually display blank white space, is it possible to fix that?

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

Try: NSMutableArray *elements = [NSMutableArray array];

Brayden Kness
Brayden Kness
12,492 Points

Did you do @property (strong, nonatomic) NSMutableArray *elements; ?

Not possible since there's no header file.