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 trialEsma Goktekin
3,870 PointsalertView does not pop up
I followed the instructions in the video. However when I click on the button signup it does not show the alerView.
Here is my code in SingupViewController.m
- (IBAction)signup:(id)sender {
NSString *username = [self.usernameField.text stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *passcode = [self.passcodeField.text stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *email = [self.emailField.text stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ([username length] == 0 || [passcode length] == 0 || [email length] == 0) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops!"
message:@"Make sure you enter a username, passcode and email address"
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
What might be wrong? Any help would be appreciated
8 Answers
Esma Goktekin
3,870 PointsProblem Solved!! Following methods were commented out in my InboxViewController.m when I first opened. I did not noticed they were not commented out in the video.
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{}
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{}
Misha Shaposhnikov
8,718 PointsTry changing the delegate of alertView from nil to self.
Esma Goktekin
3,870 Pointsnope does not work.
Misha Shaposhnikov
8,718 PointsAre you sure the username, password, and email fields have text in them when you call this fucntion?
Esma Goktekin
3,870 Pointsyes they have text in them : username, passcode and email adress..
Misha Shaposhnikov
8,718 PointsWell, the only thing I can think of now is: making sure you connected this IBAction to the correct ViewController in the Storyboard?
Esma Goktekin
3,870 PointsI double checked that too.. This is so annoying.. But thanks anyways
Gregg Mojica
11,506 PointsJust delete the alert view, clean it (Command + Shift + K), quit xcode, and reopen it. Then rewrite the alert view. Maybe that will work!
louisjuska
2,299 PointsAnd when you use caveman debugging (NSLog at the top of the action with some call out to let you know that the action is actually being called), you do in fact, see something?
Your code as posted looks fine to me.
Faisal Alsheikh
8,841 PointsDid you check if your button is connected to IBAction? connecting it by holding down on the button in story board then pressing Ctrl and dragging to your SingupViewController.h. also make sure that signup scene custom class is set to SignupViewController
Esma Goktekin
3,870 PointsYes I checked those, everything looks alright
Gregg Mojica
11,506 PointsCan you please post your project or github or Dropbox? That way, we can take a look.
Gregg Mojica
11,506 PointsGregg Mojica
11,506 PointsGreat, glad you figured it out!