Thursday, August 6, 2015

Creating a New User For Your App

JAVA

ParseUser user = new ParseUser();
user.setUsername("johndoe");
user.setPassword("p@ssw0rd");
user.setEmail("johndoe@gmail.com");
user.signUpInBackground();

SWIFT

var user = PFUser()
user.username = "johndoe"
user.password = "p@ssw0rd"
user.email = "johndoe@gmail.com"
// other fields can be set just like with PFObject
user["phone"] = "415-392-0202"

user.signUpInBackgroundWithBlock {
  (succeeded: Bool, error: NSError?) -> Void in
  if let error = error {
    let errorString = error.userInfo?["error"] as? NSString
    // Show the errorString somewhere and let the user try again.
  } else {
    // Hooray! Let them use the app now.
  }

}

No comments:

Post a Comment