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

Ryan O'Connor
Ryan O'Connor
11,282 Points

NSMutableArray

Create an NSMutableArray object called 'elements'. array should have 0 capacity.
How do i do this?

4 Answers

NSMutableArray * elements = [NSMutableArray array];

Patrick Serrano
Patrick Serrano
13,834 Points

You'll want to allocate and initialize an empty NSMutableArray. If you're still confused, you should take another look at the video related to the code challenge.

Jayden Spring
Jayden Spring
8,625 Points

NSMutableArray *elements = @{};

Stephen Wall
PLUS
Stephen Wall
Courses Plus Student 27,294 Points

Using the following will create an empty array, no need to set the capacity to 0.

NSMutableArray *elements = [NSMutableArray array];