Ios 解析';没有密码就无法注册;
由于某些原因,我的解析注册实现中的注册失败 错误似乎显而易见:Ios 解析';没有密码就无法注册;,ios,objective-c,parse-platform,Ios,Objective C,Parse Platform,由于某些原因,我的解析注册实现中的注册失败 错误似乎显而易见: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot sign up without a password.' 但是我已经尝试过从UITextField设置密码,显式设置密码,无论什么注册失败都会出现相同的错误。在提交之前,我还记录了用户的密码,以确保它已设置,并且它确实记录了 我几乎直接使用解析文
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot sign up without a password.'
但是我已经尝试过从UITextField设置密码,显式设置密码,无论什么注册失败都会出现相同的错误。在提交之前,我还记录了用户的密码,以确保它已设置,并且它确实记录了
我几乎直接使用解析文档中的代码:
PFUser* user = [PFUser user];
user.email = self.emailText.text;
user.username = self.emailText.text;
user.password = self.passwordText.text;
NSLog(@"Pword: %@", user.password);
[user setObject:self.firstNameText.text forKey:@"firstName"];
[user setObject:self.lastNameText.text forKey:@"lastName"];
[user setObject:@"customer" forKey:@"userType"];
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError* error) {
NSLog(@"Error: %@", error);
if(!error && succeeded){
[self goToProfileSelection];
} else {
NSString *errorString = [error userInfo][@"error"];
UIAlertView* usernameAlert = [[UIAlertView alloc] initWithTitle:@"Error Logging In" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[usernameAlert show];
}
}];
您是否尝试过在
NSLog
之后不使用3行setObject
?除此之外,你的代码对我来说似乎非常有效。是的,不确定你是否需要保存普通用户,然后在保存完成后添加自定义数据…我取出了那些自定义数据分配,而且它似乎仍然崩溃。它似乎与用户模型的子类化有关-我在包含用户模型时无法修复它(目前没有时间这么做),但一旦我删除了[User registerSubclass]请注意,我确实尝试了一个显式使用PFUser子类的版本,但这也不起作用