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

Mahmoud El-Set
11,602 PointsStuck with first challenge on "Build a self-destructing app" course
I have created a property of NSMutableArray and have now switched to the implementation file.
How do I create an NSMutableArray using arraWithObjects?
9 Answers

Ahmed Samy
Courses Plus Student 1,101 PointsThat is Completely Wrong NOO Way it will Work it should look like that
//[[NSMutableArray alloc] initWithObjects:(@"item 1"),(@"item 2"),nil ];

arshin
17,770 PointsImmplementation File:
self.items = [NSMutableArray arrayWithObjects:@"ObjectA",@"ObjectB",nil];

Ahmed Samy
Courses Plus Student 1,101 PointsI tried alot of codes and this Worked for me I hope I Helped http://codepen.io/anon/pen/lsdny.js Sorry there was an ERROR importing the Code so i uploaded it in Copepen

Mahmoud El-Set
11,602 PointsI may have missed something in my question.
The challenge says:
Declare a property named 'items'. Make it an NSMutableArray, and use the property modifiers 'nonatomic' and 'strong'.
<p>#import "UITableViewController.h"
@interface InboxViewController : UITableViewController
//My Answer @property (strong, nonatomic) NSMutableArray *items;
@end</p>
The next part (which I am stuck with), says:
Now switch to the implementation file and set the 'items' property to an array of two or more NSString objects using the 'arrayWithObjects' method of the NSMutableArray class.
<p>#import "InboxViewController.h"
@implementation InboxViewController
- (void)viewDidLoad { [super viewDidLoad]; // Add custom code below!
}
@end </p>
I have solved all previous challenges without big issues, but this is not clear to me. ANY help is appreciated.

Ahmed Samy
Courses Plus Student 1,101 PointsFirst U made a mistake in declaring the //@property it should look like this @property (nonatomic,strong) NSMutableArray *items; @end
Then add this code bellow //[[NSMutableArray alloc] initWithObjects:(id),......,nil;

Ahmed Samy
Courses Plus Student 1,101 Pointsif U are still facing problems please share it here

Mahmoud El-Set
11,602 PointsThis is how I understand the question:
import "InboxViewController.h"
@implementation InboxViewController
-
(void)viewDidLoad { [super viewDidLoad]; // Add custom code below! NSString *item1 = @"item1"; NSString *item2 = @"item2";
NSSArray *itemsArray = [NSArray arrayWithObjects:item1, item2];
NSMutableArray *items [NSMutableArray array];
[items addObject: itemsArray];
}
@end

Mahmoud El-Set
11,602 PointsThe error message says:
"Bummer! Compilation Error! Remember to use 'self' to reference your property and to set it as an NSMutableArray."

Mahmoud El-Set
11,602 PointsThank you very much Ahmed Samy :)

Lex Lawless
1,773 Pointsimport "InboxViewController.h"
@implementation InboxViewController
- (void)viewDidLoad { [super viewDidLoad]; // Add custom code below!
self.items = [NSMutableArray arrayWithObjects:@"Object1",@"Object2",nil];
@end
I entered the line with "self.items" and the compiler doesn't like it. What is wrong with this statement?