Почему мой код регистрации Parse не запускается? - PullRequest
0 голосов
/ 21 ноября 2018

В моем главном контроллере вида, когда нажимается кнопка, я запускаю следующий код:

if (![PFUser currentUser]) { // No user logged in
        // Create the log in view controller
        CustomSignUp *logInViewController = [[CustomSignUp alloc] init];
        [logInViewController setDelegate:self]; // Set ourselves as the delegate

        // Create the sign up view controller
        self.signUpViewController = [[TheActualSignUp alloc] init];
        [self.signUpViewController setDelegate:self]; // Set ourselves as the delegate
        self.signUpViewController.fields = (PFSignUpFieldsUsernameAndPassword
                                            | PFSignUpFieldsSignUpButton
                                            | PFSignUpFieldsEmail
                                            | PFSignUpFieldsAdditional
                                            | PFSignUpFieldsDismissButton);
        [self.signUpViewController.signUpView.additionalField setPlaceholder:@"First & Last Name"];

        [logInViewController setSignUpController:self.signUpViewController];
        logInViewController.facebookPermissions = @[ @"email", @"public_profile", @"user_friends" ];
        logInViewController.fields = (PFLogInFieldsUsernameAndPassword
                                      | PFLogInFieldsFacebook
                                      | PFLogInFieldsTwitter
                                      | PFLogInFieldsLogInButton
                                      | PFLogInFieldsSignUpButton
                                      | PFLogInFieldsPasswordForgotten);

        // Present the log in view controller

        [self.navigationController pushViewController:logInViewController animated:YES];
    }

Появляется контроллер вида для экрана входа в систему, и я могу успешно войти в систему уже созданного пользователя.Однако, когда я пытаюсь подписать кого-то, у меня возникают проблемы.Окно регистрации выглядит нормально, и я набираю все коды, но когда я нажимаю кнопку, чтобы отправить информацию, чтобы зарегистрироваться, ничего не происходит.Вот код (в том же виде контроллер).Буду очень признателен за любую помощь в этом.Использую Parse на Buddy.com.Ни один из NSLogs не вызывается при регистрации.

- (BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
    // Check if both fields are completed
    if (username && password && username.length != 0 && password.length != 0) {
        return YES; // Begin login process
    }

    [[[UIAlertView alloc] initWithTitle:@"Missing Information"
                                message:@"Make sure you fill out all of the information!"
                               delegate:nil
                      cancelButtonTitle:@"ok"
                      otherButtonTitles:nil] show];
    return NO; // Interrupt login process
}
// Sent to the delegate when a PFUser is logged in.
- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user {

    PFUser *me = [PFUser currentUser];
    NSLog(@"Regular Login");

    [self dismissViewControllerAnimated:YES completion:NULL];
}
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error {
    NSLog(@"Failed to log in...%@", error);
}

// Sent to the delegate when the log in screen is dismissed.
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController {
    [self.navigationController popViewControllerAnimated:YES];
}

- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info {
    NSLog(@"Signup");
    BOOL informationComplete = YES;
    // loop through all of the submitted data
    for (id key in info) {
        NSString *field = [info objectForKey:key];
        if (!field || field.length == 0 || ![signUpController.signUpView.additionalField.text containsString:@" "] ) { // check completion
            informationComplete = NO;
            break;
        }


    }

    // Display an alert if a field wasn't completed
    if (!informationComplete) {

        [[[UIAlertView alloc] initWithTitle:@"Missing Information"
                                    message:@"Make sure you fill out all of the information, including first & last name!"
                                   delegate:nil
                          cancelButtonTitle:@"ok"
                          otherButtonTitles:nil] show];
    }

    return informationComplete;

}
- (void)signUpViewController:(PFSignUpViewController *)signUpController didSignUpUser:(PFUser *)user {
    NSLog(@"Signed them up");
    [user saveEventually];
    [self dismissViewControllerAnimated:YES completion:nil]; // Dismiss the PFSignUpViewController


}

// Sent to the delegate when the sign up attempt fails.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error {
    NSLog(@"Failed to sign up...");
}

// Sent to the delegate when the sign up screen is dismissed.
- (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController {
    NSLog(@"User dismissed the signUpViewController");
}

1 Ответ

0 голосов
/ 29 ноября 2018

Просматривая ваш код, не сразу видно, в чем проблема.Если вы пингуете Parse в службу поддержки Buddy по адресу support@buddy.com, мы можем помочь.

...