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 trialChristian Johansson
1,772 Pointsself
I can't seem to get this to work, have tried a lot of stuff and checked internet but it says everything I insert is wrong.
#import "UIViewController.h"
@interface ViewController : UIViewController
@property (strong, nonatomic) NSString *shoppingCart;
@property (nonatomic, strong) NSArray *shoppingList;
@end
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Add your code below!
self.shoppingList = [@"toothpaste", @"bread", @"eggs"];
}
@end
1 Answer
landonferrier
25,097 PointsChristian, it seems that you have working code but there is one thing you left out in the implementation. When you assign the array some items, you forgot the @ symbol before the first square bracket.
Here is the correct implementation:
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Add your code below!
self.shoppingList = @[@"toothpaste", @"bread", @"eggs"];
@end
Christian Johansson
1,772 PointsChristian Johansson
1,772 PointsThank you! :D so stupid of me! :)
landonferrier
25,097 Pointslandonferrier
25,097 PointsChristian, no problem! Even after months of programming, I still make syntax mistakes every day! I am glad that I could help!