致命错误:init(编码器:)尚未实现Xcode 7 iOS 9

我昨晚更新了一个Xcode 6 / iOS 8项目,似乎遇到了一些问题。 其中一个是它正在抛出一个致命的错误消息并使应用程序崩溃。 当按下按钮时,我正在尝试设置下一个按钮。

let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("gameViewController") self.presentViewController(viewController, animated: true, completion: nil) 

然后在gameViewController里面我有这个:

 required init(coder aDecoder: NSCoder) { // SWIFT 2 update state = .OptionsVisible super.init(coder: aDecoder)! //fatalError("init(coder:) has not been implemented") } 

这似乎是抛出致命错误的地方,因为错误消息如下:

 fatal error: init(coder:) has not been implemented: file /pathToApp/GameOptionsViewController.swift, line 81 

在更新到所有内容的最新版本之前,这一切似乎都运行良好,我不确定是什么改变了。

像这样改写:

 required init?(coder aDecoder: NSCoder) { state = .OptionsVisible super.init(coder: aDecoder) } 

注意第一行中的问号和最后一行中没有感叹号。