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

iOS Object-Oriented Objective-C Memory, Arrays and Loops, Oh My! Review Dictionaries and Arrays

markodr
markodr
1,534 Points

There is a compiler error that I can't figure out.

I tried to solve this whit two different methods. Both works in Xcode but not on site. Can somebody explain to me why this doesn't work?

  1. NSArray *shoeOrder = @[@"Charles Smith", @(9.5), @"loafer", @"brown"];

  2. NSArray *shoeOrder = [ [NSArray alloc] initWithObjects:@"Charles Smith", @(9.5), @"loafer", @"brown", nil ]

variable_assignment.mm
NSArray *shoeOrder = [ [NSArray alloc] initWithObjects:@"Charles Smith", @(9.5), @"loafer", @"brown", nil ] ;

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey there,

Your first line is the correct one:

NSArray *shoeOrder = @[@"Charles Smith", @(9.5), @"loafer",@"brown"];

However, there seems to be currently a problem with Objective-C challenges on Treehouse returning this error when the code is correct. The Support Team is aware, but it wouldn't hurt to send them a note as well referencing the challenge link.

Hopefully this all gets fixed soon. :) :dizzy:

markodr
markodr
1,534 Points

Thaks a lot !!!! Waiting for a fix I have one more problem, maybe it is the same issue.