New Column is Not created on User Table on First Custom PFUser SignUp

195 views Asked by At

I am now trying to subclass a PFUser. Normally I would expect the uninitialized variable would be created as a column on the User table. But somehow it only create the initialized variable.

Here is how I did it.

class CustomUser: PFUser, PFSubclassing {
    @NSManaged var displayName: String;
    @NSManaged var phone: String;
    @NSManaged var profilePicture: PFFile;
    @NSManaged var birthDate: NSDate;
}

Here is how I use it.

var user = CustomUser();
user.email = emailTextField.text;
user.username = emailTextField.text;
user.password = passwordTextField.text;

user.displayName = displayNameTextField.text.capitalizedString;

user.signUpInBackground();

Notice that when the first time user register, I did not ask them to input their phone, profilePicture, and birthDate.

Parse only create displayName column for me on the table.

The previous version of Parse would have created those column on the User table automatically.

I have tried dropping the User class and do the sign up process. But those uninitialized field are not added to the column. What changed?

Any idea?

I am currently on v1.7.4.

1

There are 1 answers

0
deadbeef On BEST ANSWER

I doubt that previous versions of Parse behaved the way you expect. To my knowledge, the framework has always behaved this way, so nothing changed.

When a new object is created in the app and sent to Parse for saving, only the fields that have a non empty value are sent (along with the value). There would be no point sending column names with an empty value, it would just increase the size of the data sent to Parse for no reason.

So yes, one tiny side effect is that columns will not be created until at least one object sets a value for them. If you still want them to appear in the data browser, you can create them manually.