对< UINavigationController:0x7fd61043fce0>的Swift不平衡调用以开始/结束外观转换 [英] Swift Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7fd61043fce0>
问题描述
早上好,我是新来的人,希望这个问题不要太愚蠢.
Good day, I'm new around here, hope this question isn't too silly.
我在运行时收到警告Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7fd61043fce0>
.但是,我在代码中找不到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.
这篇关于对< UINavigationController:0x7fd61043fce0>的Swift不平衡调用以开始/结束外观转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!