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


Huh? NSMutableArray Code Challenge Part #3 (BlogReader Project)

Hey guys,

I've stumbled across an issue that I am having with this section of the code challenge.

The question would like me to remove the second object from your 'elements' array.

Here is my current code

NSMutableArray *elements = [NSMutableArray arrayWithCapacity:0];
[elements addObject:@"Helium"];
[elements addObject:@"Neon"];
[elements addObject:@"Argon"];

I go ahead and remove the following line (starting the count at 0 from helium, if that's what I'm meant to do):

[elements addObject:@"Argon"];

I go ahead and check the changes and it is incorrect. Could someone please, please, please give me some advice on this. I'm stumped on what to do as I'm still a little shaky with objective-c.

Thanking you in advance

Stu :)

3 Answers

Is it looking for

[elements removeObjectAtIndex:1];

Rather than just deleting the creation of the index, this removes it programatically.

Hey Steve,

Of course, forgot about that little bugger. Thanks for that mate :)


No problem - glad to be of some help!

or you can go around and do it this way. NSMutableArray *elements = [NSMutableArray array]; elements = [NSMutableArray arrayWithObjects:@"Helium", @"Neon", @"Argon", nil]; [elements removeObjectAtIndex:1];