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
Zachary Dalzell
3,236 PointsCode Challenege: Signing Up New Users Part 1 Help
What is wrong with this code that it's not allowing me to pass the second part (This is the task: In the 'makeGuess' method, store the text value from 'numberField' in the variable named 'userNumber'.)
(IBAction)makeGuess:(id)sender {
NSString *userNumber = [self.numberField.text];
This is the exact thing we learned in the past video.
3 Answers
Unsubscribed User
1,097 PointsI'm not an expert but maybe remove the [ ] around self.numberfield.text ? May be you can copy the error you get from xcode ?
Alessandro Covre
7,057 PointsYep, I agree with Gregory, just trying to remove square brackets. The square brackets are used when you have to call a method. When you have to access values of a property, like in this case, the brackets are not necessary :)
- (IBAction)makeGuess:(id)sender { NSString *userNumber = self.numberField.text; }
Zachary Dalzell
3,236 PointsOh jesus that's frustrating. Thanks for helping me out guys!
demetrios brinkmann
4,112 Pointsdid that work for you? i ended up doing this and passed that task of the code challenge but now i am having problems on the third part.
I cant figure out how to add the if statement that checks if the BOOL variable isCorrect is true here is what my code looks like
if (isCorrect == Yes){
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hooray!" message:@"You did it!"
delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
}
i think the alert view is all good its just the first part i am worries about....