iOS swift解析推送通知

时间:2015-08-27 01:47:32

标签: ios swift parse-platform

func singUp() {
    var user = PFUser()

    if ((self.userName.text != "") && (self.password.text != "") && (self.email.text != "") && (self.email.text == self.reenterEmail.text) && (self.gender != "")){

        user.username = "\(userName.text.lowercaseString)"
        self.userName.resignFirstResponder()
        user.password = "\(password.text.lowercaseString)"

        user.email = "\(email.text.lowercaseString)"
        user["gender"] = "\(self.gender)"



        user.signUpInBackgroundWithBlock {
            (succeeded: Bool, error: NSError?) -> Void in
            if let error = error {
                let errorString = error.userInfo?["error"] as? NSString
                self.errorAlert("\(errorString)")

             } else {
                // Hooray! Let them use the app now.

                let message = "We have sent you a link on your email to verify Your account"
                let okText = "Ok"


                let alert = UIAlertController(title: "Signin Up Completed", message: message, preferredStyle: UIAlertControllerStyle.Alert)
                let okayButton = UIAlertAction(title: okText, style: UIAlertActionStyle.Cancel, handler: { action in self.performSegueWithIdentifier("ShowSignInPage", sender: self)})
                alert.addAction(okayButton)
                self.presentViewController(alert, animated: true, completion: nil)

                let installation = PFInstallation.currentInstallation()
                installation["user"] = self.userName.text.lowercaseString
                installation.saveInBackground()

            }
        }

我遇到了安装类的问题,其中用户的信息未保存在此类中。我收到此错误:

[Error]: object not found for update (Code: 101, Version: 1.7.5) 

1 个答案:

答案 0 :(得分:0)

我认为你的问题在于这一行:

if let error = error 

你应该把它改成:

if error != nil {}

多数民众赞成应该是

相关问题