ios - 解析登录 self.logInViewController 对成员 ' logInViewController' 的模糊引用

标签 ios swift parse-platform uiviewcontroller

我正在使用 parse 为其最新的 ParseUI 提供的登录代码。我很困惑为什么我每次使用 self.logInViewControllerself.signUpViewController 时都会收到此错误,错误是:

Ambiguous reference to member 'logInViewController' and '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.")

    }

}

最佳答案

logInViewControllersignUpViewController 都未定义。

您需要定义它们:

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

关于ios - 解析登录 self.logInViewController 对成员 ' logInViewController' 的模糊引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34375935/

相关文章:

ios - 我们可以在Apple Watch中设置启动屏幕吗?

swift - 自定义文本域

swift - 为不同的按钮创建单独的主题?

ios - 解析以下 PFUser

javascript - Angular ( ionic )渲染复选框中的真实值

ios - 如何创建支持带图像背景的动态多行文本的 UIButton?

ios - 添加了 insertRowsAtIndexPaths 的 UITableView 单元格未正确绘制/布局

ios - 惠普 : 'libxml/tree.h' file not found

ios - swift 3 - 'EXC_BAD_INSTRUCTION(code=EXC_1386_INVOP,subcode=0x0)' 错误

javascript - 对象更新失败后解析回滚