Welcome to the Treehouse Community
Looking to learn something new?
Trae Cadenhead6,774 Points
Stuck on a Code Challenge in Build a Simple iPhone App with Objective C
Hello, I'm trying to get past a code challenge in "Build a Simple iPhone App with Objective C." I'm pretty positive my code response is correct (the preview isn't showing any errors), but it won't let me pass saying I have to add all three items to the array (which I am). I'm also including a screenshot.
My line of code for initializing the array:
[self.shoppingList initWithObjects: @"toothpaste", @"bread", @"eggs", nil];
You need to initialize the array before you can use it
self.shoppingList = [[NSArray alloc]initWithObjects: @"toothpaste", @"bread", @"eggs",nil];
what you have in the screen shot is basically:
["toothpaste", "bread", "eggs"]