继续获取“不平衡调用以开始/结束 <ViewController>"的外观转换错误 [英] Keep getting &quot;Unbalanced calls to begin/end appearance transitions for &lt;ViewController&gt;&quot; error

查看:21
本文介绍了继续获取“不平衡调用以开始/结束 <ViewController>"的外观转换错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个几乎运行完美的应用.以下是我的应用的结构:

I have an app that is almost running perfectly. Here is how my app is structured:

故事板上共有 6 个视图控制器.前 3 个视图控制器是最重要的.初始视图控制器具有登录"和注册"按钮.登录"按钮以模态方式呈现登录视图控制器,注册"按钮以模态方式呈现注册视图控制器.

6 total View Controllers on the storyboard. The first 3 View Controllers are the most important. The initial View Controller has buttons to "Login" and "Signup". The "Login" button modally presents a Login View Controller and the "Signup" button modally presents a Signup View Controller.

注册视图控制器有 3 个字段用于用户名、密码和电子邮件,然后是一个提交"按钮.提交按钮将数据提交到我的网络服务器,如果一切都成功提交,它会调用自身的performSegueWithIdentifier"方法.

The Signup View Controller has 3 fields for username, password, and email and then a "submit" button. The submit button submits the data to my web server and if everything submits successfully it calls the "performSegueWithIdentifier" method on itself.

声明如下:

[self performSegueWithIdentifier:@"superSegue" sender:self];

今晚我花了 2 个小时试图让上述方法调用起作用,它终于起作用了.为了让它工作,我必须在情节提要上选择我的注册视图控制器,然后转到编辑器 > 嵌入 > 导航控制器(如果我没记错的话,我必须这样做,因为注册视图控制器是以模态呈现的).然后我从我的注册视图控制器的提交按钮拖到我想要推送到的视图控制器并选择推送,然后输入标识符名称.

I spent 2 hours tonight trying to get the above method call to work and it finally does work. To get it to work, I had to select my Signup View Controller on the storyboard and go to Editor > Embed In > Navigation Controller (If I remember correctly I had to do this because the signup view controller is presented modally). I then dragged from my Signup View Controller's submit button to the View Controller I want to push to and selected Push and then typed in an identifier name.

无论如何,在我尝试使用我们使用方法调用推送到的视图控制器上的后退按钮之前,上述所有内容都可以正常工作.如果我点击后退按钮,它会进入 90% 的黑色屏幕,顶部有一个空白导航栏和一个后退按钮,当然后退按钮也没有任何作用.

Anyways, all of the above works perfectly fine until I try to use the back button on the View Controller that we pushed to using the method call. If I tap the back button, it goes to a 90% black screen with a blank nav bar at the top with a back button and of course that back button does nothing as well.

这是我在控制台中得到的错误:

This is the error that I get in the console:

Unbalanced calls to begin/end appearance transitions for <VerificationViewController: 0x14ed1bb0>

验证视图控制器是注册视图控制器通过 performSegueWithIdentifier 方法推送到的视图控制器.

Verification View Controller is the View Controller that the Signup View Controller pushes to via the performSegueWithIdentifier method.

有谁知道我该如何解决这个错误?

Does anyone know how I can fix this error?

我在下面附上了一张我的故事板在 xcode 中的样子的屏幕截图.有一个我已经编码但尚未连接的视图控制器,无论如何都不应该有所作为,因此您可以忽略登录 VC 右侧的视图控制器.

I have included a screenshot below of what my storyboard looks like in xcode. There is a view controller that I have coded but not connected yet and shouldn't make a difference anyways so you can ignore the View Controller to the right of the Login VC.

推荐答案

今天早上我在另一个 stackoverflow 问题中找到了答案.可以在此处找到答案.

I found the answer this morning in another stackoverflow question. The answer can be found here.

当我最初设置 Push Segue 时,我单击并从一个按钮拖动,并且还在该按钮的 IBAction 方法实现中调用了 performSegueWIthIdentifier 方法.这导致在按下按钮时执行 2 个相同的 push segue.我只是在 IBAction 中保留了我的方法调用,删除了旧的 push segue,并创建了一个新的 push segue,只是这次我单击并从整个视图控制器而不是按钮拖动.

When I had originally setup the Push Segue, I clicked on and dragged from a button, and was also calling the performSegueWIthIdentifier method inside that button's IBAction method implementation. This was causing 2 identical push segues to be executed on the button press. I just left my method call in the IBAction, deleted the old push segue, and created a new push segue only this time I clicked on and dragged from the entire View Controller instead of it's button.

这篇关于继续获取“不平衡调用以开始/结束 <ViewController>"的外观转换错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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