I am trying to develop an application that have a sign-up page, in fact I am using Parse.com for the database, I've used the PFUser for the (Username,password, Email) and it works so fine, but it happen that I have additional information in the signup page such as (name,DOB and location) so when I added them I got an error:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't use nil for keys or values on PFObject. Use NSNull for values.
Note that I have a table that name User (The default one that parse provide) and I want to add the (name,DOB and the location) to that table User but I get that error.
Here is my code
- (void) Registeruser {
PFUser *newUser = [PFUser user];
newUser.username = UserNameS.text;
newUser.email= EmailS.text;
newUser.password=PasswordS.text;
PFObject * newUser1 = [PFObject objectWithClassName:@"User"];
newUser1[@"name"]= NameS.text;
newUser1[@"gender"]= genderS.text;
newUser1[@"Location"]=genderS.text;
NSString *dateStr = DOBS.text;
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateStyle:NSDateFormatterLongStyle];
[dateFormat setTimeStyle:NSDateFormatterShortStyle];
NSDate *date = [dateFormat dateFromString:dateStr];
newUser1[@"dateofBirth"]=date;
[newUser signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (!error) {
NSLog(@"Registration success!");
UserNameS.text = nil;
PasswordS.text = nil;
EmailS.text = nil;
NameS.text=nil;
DOBS.text=nil;
LocationS.text=nil;
genderS.text=nil;
[self performSegueWithIdentifier:@"login" sender:self];}
else {
NSLog(@"There was an error in registration");
}}];}