Note that there are some explanatory texts on larger screens.

plurals
  1. POprogram crashes for an API call iphone
    primarykey
    data
    text
    <p>I have two pages:</p> <p>login page an d sign up page:</p> <p>for login page, I am using the following to get the information and pass the fail or success response to user:</p> <pre><code>- (void)login:(UIButton *)sender { [self.appDel.api loginWithEmail:self.email.text password:self.password.text completionHandler:^(id response, NSError *error) { if (error) { NSLog(@"ERROR: %@", error); } else { if ([[response objectForKey:Status] isEqualToString:Success]) { self.currentUser = [response objectForKey:kResponseUser]; self.currentUserProfile = [response objectForKey:Profile]; [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL]; } else { NSLog(@"FAIL: %@", response); [[[UIAlertView alloc] initWithTitle:@"Login Failed" message:[response description] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } } }]; } </code></pre> <p>Using this for login page, if user don't complete the two required texfields or have one of them filled the other empty and press Login he will receive fail message.</p> <p>in the sign up case however the program crashes when textfields are empty and we click on sign up. how should I change this:</p> <pre><code>-(void)signUp:(UIButton *)sender { [self.api signup:self.Email.text password:self.Password.text confirmationPassword:self.ConfirmPassword.text firstName:self.FirstName.text completionHandler:^(id response, NSError *error) { if (error) { NSLog(@"ERROR: %@", error); } else { if ([[response objectForKey:Status] isEqualToString:Success]) { self.appDel.theNewUser = [response objectForKey:User]; self.appDel.theNewUserProfile = [response objectForKey:Profile]; [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL]; } else { NSLog(@"FAIL: %@", response); [[[UIAlertView alloc] initWithTitle:@"SignUp Failed" message:[response description] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } } }]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload