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

Could really use some help/hints on these questions when we get stuck. Please help with question #3.

very frustrating to not have any resources to steer us the right direction or provide the answer so we can learn, instead of being stuck on the same issue for an extended period of time

1 Answer

Travis McCormick
Travis McCormick
2,313 Points

Hey there!

I can completely understand where you're coming from. I think most students on Treehouse can relate to some extent.

However, forcing you to solve the challenge will ensure that you aren't moving forward to new information until you understand how it works. There are a lot of courses out there that just give you the answer and it makes it easy to just move on even though you don't fully understand it.

Here is what I would recommend when you're not understanding something and you've tried to solve it yourself:

1. Search Apple's Documentation.

This has helped me many times and it has gotten me in the habit to check there if I'm having trouble with something. You can find this by clicking "Help" in the Xcode menu bar and click on "Documentation and API Reference". It opens in a new window, so just leave it open and you can quickly jump back to it if you run into another problem.

2. Get help in Treehouse.

The community on Treehouse is awesome and everyone is very helpful. This is probably one of the best resources to use because other students can help you with the specific challenge you are trying to solve. This will also give you some good practice learning how to ask questions.

3. Google it.

Chances are, someone else has run into the same problem. Stackoverflow.com always has a lot of information and there is a huge community that is actively answering questions there.

Also, it is helpful to re-watch the previous videos. Pasan covers everything you need to know in order to solve the challenge. With the challenge in mind, re-watching the video will likely get you that "ah-ha" moment and you'll be even happier because you solved it on your own.

Best of luck!

Travis

ARMANDO RODRIGUEZ
ARMANDO RODRIGUEZ
4,216 Points

No, he's right. The test isn't working properly.
I've tried both ways of initializing an NSMutableDictionary in one line and both fail the code check.

NSMutableDictionary *carDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Make", @"Honda", @"Model", @"Accord", nil];

This one fails.

NSMutableDictionary *carDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Make", @"Honda", @"Model", @"Accord", nil];

This one fails too. Those are the ONLY ways to do it in one line.
The only way to do it other than that is two lines...

NSMutableDictionary *carDict = [NSMutableDictionary alloc];
[carDict initWithObjectsAndKeys:@"Make",@"Honda",@"Model",@"Accord",nil];

There's something wrong with the test.