<UINavigationController: 0x7fd61043fce0> 的 Swift Unbalanced 调用开始/结束外观转换 [英] Swift Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7fd61043fce0>

查看:43
本文介绍了<UINavigationController: 0x7fd61043fce0> 的 Swift Unbalanced 调用开始/结束外观转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天,我是新来的,希望这个问题不会太愚蠢.

Good day, I'm new around here, hope this question isn't too silly.

我收到警告 Unbalanced calls to begin/end appearance transitions for 在运行时.但是,我在代码中找不到任何包含 UINavigationController 的地方,也找不到项目中的任何其他文件.

I got the warning Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7fd61043fce0> during runtime. However, I cannot find anywhere in my code that has UINavigationController, nor any other file in the project.

import UIKit
class ViewController: UIViewController,PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate, FBLoginViewDelegate {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    //self.navigationController?.navigationBarHidden = true

    if(PFUser.currentUser() == nil){


        var logInViewController = PFLogInViewController()
        logInViewController.delegate = self

        //customize logInViewController
        logInViewController.fields = PFLogInFields.UsernameAndPassword | PFLogInFields.LogInButton | PFLogInFields.PasswordForgotten | PFLogInFields.Facebook | PFLogInFields.SignUpButton

        logInViewController.facebookPermissions = ["public_profile", "email", "user_friends"]

        logInViewController.logInView.logo  = UIImageView(image: UIImage(named: "Logo"))

        //create a signUpViewController instance
        var signUpViewController = PFSignUpViewController()
        signUpViewController.delegate = self

        //add signUpViewController instance to logInViewController for signUp module.
        logInViewController.signUpController = signUpViewController

        self.parentViewController?.presentViewController(logInViewController, animated: true, completion: nil)

    }else{
        FBSession.activeSession().close()
    }

}

我是否遗漏了应该检查的内容?

Am I missing something that I should check?

推荐答案

我会将登录的显示从 viewDidLoad 移动到 viewWillAppear.这将确保在显示另一个控制器之前在当前控制器中设置了所有内容.

I would move the presentation of the login to viewWillAppear from viewDidLoad. This will make sure everything is setup in the current controller before you show another.

同时显示来自 self 而不是 self.parentViewController 的登录控制器.这可能是您的错误的来源.

Also present the login controller from self and not self.parentViewController. This could be where your error comes from.

这篇关于&amp;lt;UINavigationController: 0x7fd61043fce0&gt; 的 Swift Unbalanced 调用开始/结束外观转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆