Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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];