Ios 解析登录问题无效的登录参数
当我尝试使用我的应用程序id和客户端id登录ios模拟器进行解析时,它显示“无效的登录参数(代码:101,版本:1.8.2)”,但当我尝试Udemy的ios导师的应用程序id和客户端id时,它工作正常。我的代码很好,我认为问题在于解析。有没有人遇到过这样的问题 导入UIKit 导入解析 进口螺栓 类ViewController:UIViewController{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
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.
}
}我确实遇到了这个问题,我做了两件事:
只要输入正确的用户名和密码就可以了 显示您的代码。还要确保你在parse.com上创建了一个新的应用程序后,安装了parse框架并阅读了它们的迷你教程。在本教程结束时,它将允许您测试设置,并通知您是否已正确设置。