0
當前正在以parse.com作爲後端的登錄系統上工作。我輸入了我認爲完全有效的代碼,但仍然收到無效的登錄參數。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)
}
}
如果這對您有用,請接受此爲正確答案,以便用戶在將來可以看到相同的答案。 –
感謝您的答案......但它似乎並沒有工作......它仍然是無效的登錄參數,它顯示的消息是我放在其他語句後的消息。所以這意味着它是零。 – NewBeginnings
nvmd它的工作感謝您的幫助! – NewBeginnings