在完成图片选择之前,请勿完成解析注册

时间:2015-01-06 19:25:55

标签: ios parse-platform uiimagepickercontroller uiactionsheet

我想在用户注册时使用Parse的应用程序添加个人资料图片,但是我不想创建一个全新的ViewController来执行此操作。在shouldBeginSignUp的代表中,我有基本的:

- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info {

    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;

}

这将阻止注册过程,直到所有字段都完成。我想要做的是点击注册,让它弹出UIActionSheet要求选择个人资料照片或拍摄新照片。拍摄照片后,它会将其添加到PFUser。你会怎么建议这样做?

1 个答案:

答案 0 :(得分:0)

您需要始终从该委托方法中返回“否”,但我并非100%确定您能够在用户设置自定义文件/引用之前将其保存(需要测试)。

验证通过后,您仍会返回NO,但会触发您选择图像的操作。选择图像后,您将关闭所有内容并使用PFUser手动完成注册过程(您可能需要手动创建用户并迭代注册控制器的字段以使用用户选择填充它)。 / p>