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 trialJayant Sani
4,354 PointsNot Working
Why is this code challenge not accepting my response when I type the line:
NSMutableArray *elements = [NSMutableArray initWithCapacity:0];
3 Answers
Kai Aldag
Courses Plus Student 13,560 Pointswell 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.
Jayant Sani
4,354 PointsLegend. 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).
Kai Aldag
Courses Plus Student 13,560 Pointsyes i totally agree.
to our iOS journeys, Kai.
Ben Zenker
3,210 PointsSame issue. but i doubt they will update stuff like that now with swift being the new hot thing right around the corner
Kai Aldag
Courses Plus Student 13,560 Pointsya swift should definitely be a top priority to put out content for.