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

Signing Up New Users Part 1 Code Challenge

I am having a problem solving this code challenge. The question is: "If the guess is correct, we want to alert the user with a message using a UIAlertView. Add an if statement that checks if the BOOL variable 'isCorrect' is true (or 'YES'). Inside the if statement, declare a new UIAlertView variable named 'alertView'. Alloc/init it with the method 'initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles'. For the title, use "Hooray!", for the message, use "You did it!", for the delegate use nil, for cancelButtonTitle use "OK", and for otherButtonTitles use nil."

Below is my code.

if( isCorrect == YES ) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hooray!" message:@"You did it!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; }

What am I doing incorrectly?

2 Answers

OK, I retook the challenge and pasted in the code you have posted above. It gave me an error. Bummer! Make sure you use the correct cancel button title as specified in the instructions!

Then I only retyped 'OK' and made sure both letters were upper case and left the rest of your code alone. And it passed.

What you're experiencing is weird. I'd suggest starting the challenge over? But make sure you copy and save the code you have above. So you can just paste in the challenge again.

Wow, for some reason it passed when I did what you instructed.

Thank you!

I know it's weird, right? Must be a bug, glitch, or gremlin. Hehe.

It looks alright to me, but try capitalizing the 'K' in in @"Ok". I think the challenge answer is case sensitive.

David,

I capitalized the "K" and it still was not successful.