Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 解析登录问题无效的登录参数_Ios_Parse Platform - Fatal编程技术网

Ios 解析登录问题无效的登录参数

Ios 解析登录问题无效的登录参数,ios,parse-platform,Ios,Parse Platform,当我尝试使用我的应用程序id和客户端id登录ios模拟器进行解析时,它显示“无效的登录参数(代码:101,版本:1.8.2)”,但当我尝试Udemy的ios导师的应用程序id和客户端id时,它工作正常。我的代码很好,我认为问题在于解析。有没有人遇到过这样的问题 导入UIKit 导入解析 进口螺栓 类ViewController:UIViewController{ var signUp = true // for creating current mode of the page @IBOutl

当我尝试使用我的应用程序id和客户端id登录ios模拟器进行解析时,它显示“无效的登录参数(代码:101,版本:1.8.2)”,但当我尝试Udemy的ios导师的应用程序id和客户端id时,它工作正常。我的代码很好,我认为问题在于解析。有没有人遇到过这样的问题

导入UIKit 导入解析 进口螺栓

类ViewController:UIViewController{

var signUp = true // for creating current mode of the page

@IBOutlet weak var username: UITextField!


@IBOutlet weak var password: UITextField!
//登录iv出口

@IBOutlet weak var signUpB: UIButton!
@IBOutlet weak var loginB: UIButton!
@IBOutlet weak var registerText: UILabel!
var activityIndicator:UIActivityIndicatorView = UIActivityIndicatorView() // for spinner

//for displaying alert 
func displayAlert(title:String,message:String){

    var alert = UIAlertController(title:title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction((UIAlertAction(title: "ok", style: .Default , handler: { (action) -> Void in

        self.dismissViewControllerAnimated(true, completion: nil)

    })))

    self.presentViewController(alert, animated: true, completion: nil)


}

@IBAction func signUp(sender: AnyObject) {

    if username.text == "" || password.text == "" {

    displayAlert("Error in form", message: "Please enter username and password")



    }

    else  {

        activityIndicator = UIActivityIndicatorView(frame: CGRectMake(0, 0, 50, 50))
        activityIndicator.center = self.view.center

        activityIndicator.hidesWhenStopped = true
        activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
        view.addSubview(activityIndicator)
        activityIndicator.startAnimating()
        UIApplication.sharedApplication().beginIgnoringInteractionEvents()

        var errorMessage = "Please try again later"
        if signUp == true
        {

        var user = PFUser()
        user.username = username.text
        user.password = username.text


        user.signUpInBackgroundWithBlock(

            {(success, error) -> Void in

            self.activityIndicator.stopAnimating()

            UIApplication.sharedApplication().endIgnoringInteractionEvents()

            if error == nil
            {
            // sign up successful
            }
            else  {
                if let errorString = error!.userInfo?["error"] as? String
                {

                    errorMessage = errorString
                }
                self.displayAlert("Failed ", message: errorMessage)

                   }

              })
          }      else  {


                       PFUser.logInWithUsernameInBackground(username.text, password: password.text, block:
                        { (user, error) -> Void in

                            self.activityIndicator.stopAnimating()

                            UIApplication.sharedApplication().endIgnoringInteractionEvents()

                            if user != nil
                                  {
                                     //  logged in
                                   }

                            else   {


                                if let errorString = error!.userInfo?["error"] as? String
                                {

                                    errorMessage = errorString
                                }
                                self.displayAlert("Failed Login", message: errorMessage)


                                    }

                         })
                        }



            }



       }

@IBAction func login(sender: AnyObject) {
    if signUp == true {

        signUpB.setTitle("Login", forState: UIControlState.Normal)

        registerText.text = "Not Registered?"
        loginB.setTitle("Sign Up", forState: UIControlState.Normal)

        signUp = false
    }

    else{

        signUpB.setTitle("Sign Up", forState: UIControlState.Normal)

        registerText.text = "Already Registered?"
        loginB.setTitle("Login", forState: UIControlState.Normal)

        signUp = true

    }

}


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.
}

}我确实遇到了这个问题,我做了两件事:

  • 在AppDelegate中,我将其注释掉
  • //PFUser.enableRevocableSessionInBackground()的

    详情如下:

    2在您的登录viewController中(更新到新的Facebook SDK后),我添加了以下内容:

    导入ParseFacebookUtilsV4

    我遇到了相同的错误“登录参数无效”,我知道原因

    问题是来自解析的响应消息本身,它使我们感到困惑

    “无效登录参数”表示“用户名或密码错误”


    只要输入正确的用户名和密码就可以了

    显示您的代码。还要确保你在parse.com上创建了一个新的应用程序后,安装了parse框架并阅读了它们的迷你教程。在本教程结束时,它将允许您测试设置,并通知您是否已正确设置。