in my app when i try to sign up the PFObjects are not saved in background (emailLabel, FirstNameLabel, LastNameLabel, PasswordLabel. any idea why
Here is is a code snippet
@IBAction func NextSignupPage(sender: AnyObject) {
let FirstNameObject = PFObject(className: "\(self.FirstNameLabel.text)")
FirstNameObject["First Name"] = "\(self.FirstNameLabel.text)"
FirstNameObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
}
let FamilyNameObject = PFObject(className: "\(self.FamilyNameLabel.text)")
FamilyNameObject["Family Name"] = "\(self.FamilyNameLabel.text)"
FamilyNameObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
}
let PasswordObject = PFObject(className: "\(self.PasswordLabel.text)")
PasswordObject["password"] = "\(self.PasswordLabel.text)"
PasswordObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
println("successfully signed Up.")
There are several problems that I see that might be causing the issues you are experiencing. First, as mentioned in the comments by flashadvanced, you should be using the Parse provided
user.signUpInBackground
to sign up new users. (Most importantly because Parse will encrypt your user's passwords. It seems as though you are planning on storing them as regular strings.) The docs to accomplish this can be found here.In regards to creating
PFObjects
in general, it seems as though you want to create onePFObject
that store the first name, family name and password. Your code above will create three differentPFObjects
that have no relationship to one another. In addition, you supply three different classes to the differentPFObjects
, another reason why they will not show up in the same class on the Parse server. The correct way of accomplishing this (considering that you should still be using the.signUpInBackground
method and this applies only to other non- specificPFObjects
) would be: