Ios 中止-导航控制器消失

Ios 中止-导航控制器消失,ios,uinavigationcontroller,storyboard,segue,Ios,Uinavigationcontroller,Storyboard,Segue,我在按下按钮时引发异常。该按钮与序列(故事板的一部分)关联 *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'changeRooms'. Push segues can only be used when the source controller is managed by an instan

我在按下按钮时引发异常。该按钮与序列(故事板的一部分)关联

*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'changeRooms'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
调用堆栈没有给出异常抛出位置的提示。在尝试深入研究异常时,我在prepareForSegue中发现了以下内容:(在切换到view controller RoomsListVc.m时选择oomVC.m)

创建输出:

2013-02-16 15:41:57.201 Wohnungsprotokoll[1906:c07] navController1: (null)
2013-02-16 15:41:57.203 Wohnungsprotokoll[1906:c07] navController2: (null)
在那个阶段,我有点期待destinationViewController尚未分配navigationController。这就是为什么我将其与其他视图控制器的prepareForSegue中的状态进行比较。它们都产生相同的输出:(KeysEditVC.m-从这里开始,它被划分为ChooseRomVC)

输出:

2013-02-16 15:41:52.181 Wohnungsprotokoll[1906:c07] navControllerx: <UINavigationController: 0xa22c5d0>
2013-02-16 15:41:52.182 Wohnungsprotokoll[1906:c07] navControllery: (null)
输出:

2013-02-16 15:41:52.212 Wohnungsprotokoll[1906:c07] navController0: <UINavigationController: 0xa22c5d0>
2013-02-16 15:41:52.212 Wohnungsprotokoll[1906:c07]导航控制器0:
因此,很明显,当我的视图控制器(ChooseRomVC.m)正在执行时,navigationController分配不知何故在某个地方丢失了。我确实向ViewWillExample和ViewWillEvery添加了类似的NSLogs,并且self.navigationController设置正确

我非常乐意提供代码或屏幕截图等,但我不知道从哪里开始。请建议:

为了完整起见:我使用故事板和ARC、iOS 6.1、iOS模拟器以及iPhone设备,在OS-X 10.8.2上使用xcode 4.6


只有一件事可能是不寻常的。当抛出错误时,我使用的视图控制器可以从多个视图控制器中分离出来。但我使用的不仅仅是这个视图控制器,它在所有其他情况下都可以正常工作。

在我花了很长时间才把它确定下来并为这个问题整理好之后,现在我找到了它

在IB中,我从同一视图的另一个按钮复制了与此序列关联的按钮。从该原始按钮复制后,还剩下一个操作分配。本应与另一个按钮关联的IBAction方法执行了一些业务逻辑并调用

[self.navigationController popViewControllerAnimated:YES];
所以我继续往下走,差不多同时回到父视图控制器! 当然,这是行不通的。不过,我会把它留在这里,这样可能有人会比我更快地找到问题的根源

NSLog (@"navController0: %@", self.navigationController);
2013-02-16 15:41:52.212 Wohnungsprotokoll[1906:c07] navController0: <UINavigationController: 0xa22c5d0>
[self.navigationController popViewControllerAnimated:YES];