I am using parse's provided login code for their latest ParseUI. I am confused why I am getting this error every single time I use self.logInViewController
and self.signUpViewController
, the error being:
Ambiguous reference to member 'logInViewController' and 'signUpViewController'
Here is my code:
import Parse
import ParseUI
import UIKit
class ViewController: UIViewController, PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate {
@IBAction func simpleAction(sender: AnyObject) {
self.presentViewController(self.logInViewController, animated: true, completion: nil)
}
@IBAction func customAction(sender: AnyObject) {
self.performSegueWithIdentifier("custom", sender: self)
}
@IBAction func logoutAction(sender: AnyObject) {
PFUser.logOut()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
if (PFUser.currentUser() == nil) {
self.logInViewController.fields = PFLogInFields.UsernameAndPassword | PFLogInFields.LogInButton | PFLogInFields.SignUpButton | PFLogInFields.PasswordForgotten | PFLogInFields.DismissButton
var logInLogoTitle = UILabel()
logInLogoTitle.text = "Parse"
self.logInViewController.logInView.logo = logInLogoTitle
self.logInViewController.delegate = self
var SignUpLogoTitle = UILabel()
SignUpLogoTitle.text = "Parse"
self.signUpViewController.signUpView.logo = SignUpLogoTitle
self.signUpViewController.delegate = self
self.logInViewController.signUpController = self.signUpViewController
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func logInViewController(logInController: PFLogInViewController!, shouldBeginLogInWithUsername username: String!, password: String!) -> Bool {
if (!username.isEmpty || !password.isEmpty) {
return true
}else {
return false
}
}
func logInViewController(logInController: PFLogInViewController!, didLogInUser user: PFUser!) {
self.dismissViewControllerAnimated(true, completion: nil)
}
func logInViewController(logInController: PFLogInViewController!, didFailToLogInWithError error: NSError!) {
print("Failed to login...")
}
func logInViewControllerDidCancelLogIn(logInController: PFLogInViewController!) {
}
func signUpViewController(signUpController: PFSignUpViewController!, didSignUpUser user: PFUser!) {
self.dismissViewControllerAnimated(true, completion: nil)
}
func signUpViewController(signUpController: PFSignUpViewController!, didFailToSignUpWithError error: NSError!) {
print("FAiled to sign up...")
}
func signUpViewControllerDidCancelSignUp(signUpController: PFSignUpViewController!) {
print("User dismissed sign up.")
}
}
logInViewController
and signUpViewController
are both undefined.
You need to define them with:
let logInViewController = PFLogInViewController()
let signUpViewController = PFSignUpViewController()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.