转至 Storyboard Reference 后出错

Error after segue to Storyboard Reference

我从一个视图控制器以 Objective C 编写的情节提要转到另一个视图控制器以 Swift 编写的情节提要 2 并顺利进行。

但是,当我在第二个 Storyboard 中单击 fire the next segue 时,出现以下错误:

*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'record'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

这是在 Swift 2

中调用下一个 segue 的代码
self.performSegueWithIdentifier("record", sender: nil)

第二个情节提要中的初始视图也嵌入到导航控制器中。

同样值得注意的是,我试过没有第一个故事板,我的应用程序直接进入第二个故事板,它发现 segue 很好。

关于可能导致问题的原因有什么想法吗?

选择 segue,转到其 Attributes inspector 并将 Kind 从 push 更改为 Modal。让演示文稿和过渡保持默认。

这很适合你。

但是如果你想要那种'Push'的segue,那么用Objective-C编写的第一个View controller应该嵌入到Navigation Controller中。