2015-12-19 31 views
0

我正在使用parse提供的登錄代碼爲他們的最新ParseUI。我很困惑,爲什麼我收到此錯誤每一次我用self.logInViewControllerself.signUpViewController,錯誤的存在:解析登錄self.logInViewController模糊引用成員'logInViewController'

曖昧參考成員「logInViewController」和「signUpViewController」

這裏是我的代碼:

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.") 

    } 

} 

回答

1

logInViewControllersignUpViewController都未定義。

您需要與定義它們:

let logInViewController = PFLogInViewController() 
let signUpViewController = PFSignUpViewController()