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 Build a Blog Reader iPhone App Getting Data from the Web Mutable vs Immutable

Not Working

Why is this code challenge not accepting my response when I type the line:

NSMutableArray *elements = [NSMutableArray initWithCapacity:0];

3 Answers

well what you need to do is set its capacity to one because when you call an object you say atIndex:0 because that's its memory address, but when setting up the array you want to let it hold 1 because 1 does not point to the address, it simply says that it can hold one object.

here's my code i put and it past.

NSMutableArray *elements = [NSMutableArray arrayWithCapacity:1];

Hope this helps, Kai.

Legend. Thanks, it ended up working.

But, that syntax is deprecated. They should really update this and also allow dictionary literal syntax (which I've tried as well).

yes i totally agree.

to our iOS journeys, Kai.

Ben Zenker
Ben Zenker
3,210 Points

Same issue. but i doubt they will update stuff like that now with swift being the new hot thing right around the corner

ya swift should definitely be a top priority to put out content for.