Ios parse.com中的登录参数无效

Ios parse.com中的登录参数无效,ios,swift,parse-platform,Ios,Swift,Parse Platform,目前正在使用parse.com作为后端的登录系统。我已经输入了我认为完全有效的代码,但仍然得到无效的登录参数 我不知道发生了什么 import UIKit import Parse class ViewController: UIViewController { @IBOutlet weak var userEmailAddressTextField:UITextField! @IBOutlet weak var userPasswordTextField: UITextFie

目前正在使用parse.com作为后端的登录系统。我已经输入了我认为完全有效的代码,但仍然得到无效的登录参数

我不知道发生了什么

import UIKit
import Parse
class ViewController: UIViewController {
    @IBOutlet weak var userEmailAddressTextField:UITextField!

    @IBOutlet weak var userPasswordTextField: UITextField!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func signInButtonTapped(sender: AnyObject) {
    let userEmail = userEmailAddressTextField.text
    let userPassword = userPasswordTextField.text
        if(userEmail.isEmpty || userPassword.isEmpty) {
         return
        }

        PFUser.logInWithUsernameInBackground(userEmail, password: userPassword) {
            (user:PFUser?, error:NSError?) -> Void in

            var userMessage = "Welcome!"

            if(user != nil)
            {




            } else {
                userMessage = error!.localizedDescription


            }
            var myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertControllerStyle.Alert)
            let okAction = UIAlertAction(title: "ok", style: UIAlertActionStyle.Default, handler: nil)
            myAlert.addAction(okAction)
            self.presentViewController(myAlert, animated: true, completion: nil)
        }
    }

我相信这段代码应该是你问题的解决方案。如果这不起作用,请确保在AppDelegate.swift中正确输入了您的客户端密钥和应用程序ID。

如果这对您有效,请接受这一正确答案,以便用户将来可以看到该答案。感谢您的回答。。。但它似乎不起作用。。。它仍然是无效的登录参数,并且它显示的消息是我在else语句之后放置的消息。这意味着零。非常高兴我能帮上忙:
@IBAction func signInButtonTapped(sender: AnyObject) {
let userEmail = userEmailAddressTextField.text
let userPassword = userPasswordTextField.text
if userEmail.isEmpty || userPassword.isEmpty {
    println("You forgot to fill in some fields, please try again.")
}

PFUser.logInWithUsernameInBackground(userEmail, password: userPassword) {
    (user: PFUser?, error: NSError?) -> Void in
    if user != nil {
        // Do stuff after successful login.
    } else {
        var myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertControllerStyle.Alert)
        let okAction = UIAlertAction(title: "ok", style: UIAlertActionStyle.Default, handler: nil)
        myAlert.addAction(okAction)
        self.presentViewController(myAlert, animated: true, completion: nil)

    }
}