«Данные не могут быть прочитаны, потому что они не в правильном формате» Ошибка при разборе [Xcode Swift] - PullRequest
0 голосов
/ 15 октября 2019

Я делаю простой вход, используя heroku, однако я получаю общую ошибку

the data couldn't be read because it isn't in the correct format

ни один из моих входов не является нулевым, см. Распечатку ниже:

Ввод:

User field = "testuser"

password field = "1"

email field = "testemail@gmail.com"

fullname field = "me tester"

Вот мой код:

@IBAction func signUpBtn_click(_ sender: AnyObject) {
    print("sign up pressed")

    let user = PFUser()
    user.username = usernameTxt.text?.lowercased()
    user.email = emailTxt.text?.lowercased()
    user.password = passwordTxt.text
    user["fullname"] = fullnameTxt.text?.lowercased()
    print("user-->", user)

    user.signUpInBackground { (success, error) -> Void in
        if success {
            print("Logged in")

            UserDefaults.standard.set(user.username, forKey: "username")
            UserDefaults.standard.synchronize()   



            let appDelegate : AppDelegate = UIApplication.shared.delegate as! AppDelegate
            appDelegate.login()

        } else {

            let alert = UIAlertController(title: "Error", message: error!.localizedDescription, preferredStyle: UIAlertController.Style.alert)
            let ok = UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel, handler: nil)
            alert.addAction(ok)
            self.present(alert, animated: true, completion: nil)
        }
    }
}

распечатать =

user--> <PFUser: 0x600002225000, objectId: new, localId: (null)> {
email = "testemail@gmail.com";
fullname = "me tester";
password = 1;
username = testuser;
}

Может кто-нибудь помочь с этой проблемой?

спасибо

...