1

I have a hard time implementing newUser with parse. I'm following a tutorial about this sign-up Parse version.

Why is only password working and not the other codes?

self.actInd.startAnimating()

var newUser = PFUser()
newUser.name = name
newUser.surname = surname
newUser.birth = birth
newuser.email = email
newUser.password = password  <- // why only password works?
newUser.confirmpassword = confirmpassword

Why only password works and not the others?

luk2302
  • 55,258
  • 23
  • 97
  • 137

1 Answers1

0

Two things should work: email and password.

Reason for that is that the PFUser has a couple of properties:

  • username
  • password
  • email

You email-line does however not work because you misspelled newUser - you wrote newuser (lower case U)

The "regular" PFUser just does not have the property confirmPassword for example - did you somewhere tell the compiler that it should have that property? Same goes for the other properties.

Solution

Your probably have to create a subclass of PFUser and register that subclass - for example like in this question/answer: Subclass PFUser in swift

Community
  • 1
  • 1
luk2302
  • 55,258
  • 23
  • 97
  • 137
  • So Parse only has 3 selected properties that work, if I need more I'll have to create them? **Did you somewhere tell the compiler that it should have that property?:** `var confirmpassword = self.confirmPasswordField.text` Do you mean like this? – Robin Alsalehy Nov 19 '15 at 08:16
  • Exactly, Parse by default has only those 3 properties for you. But of course you can tell Parse that your user has more than that. An example for how to do that is present in the linked question - i just changed the link destination, you might want tot check the link again ;) – luk2302 Nov 19 '15 at 08:19
  • How do I hug you over the internet? <3 :D Thanks! – Robin Alsalehy Nov 19 '15 at 08:21
  • The code line you mention only show you trying to assign something, but you never told Parse that the user actually *has* that property. – luk2302 Nov 19 '15 at 08:21
  • Yeah, I'm getting the hang of it slowly. :D By the way may I add you to facebook or anything else to keep to in touch? =) – Robin Alsalehy Nov 19 '15 at 08:33
  • No thanks - but happy to have helped - only thing you can do when you get enough reputation is leave an upvote ;) – luk2302 Nov 19 '15 at 08:34
  • I understand haha xD Just to be precise, when creating the subclass, should I do it in the "sign-up" class or in the Signup button action? – Robin Alsalehy Nov 19 '15 at 08:48
  • Or just create another swift file and be done with it. :PP – Robin Alsalehy Nov 19 '15 at 08:56