【发布时间】:2015-10-07 14:35:19
【问题描述】:
当我在 iPhone 上尝试 instantiateViewControllerWithIdentifier 时,应用程序会崩溃,尽管这在 ios 模拟器上运行良好。我使用的代码是:
let questionsGameVC: QuestionsGame = self.storyboard?.instantiateViewControllerWithIdentifier("Questions") as! QuestionsGame
它说的错误是
致命错误:在展开可选值时意外发现 nil
有人可以在出错的地方添加任何内容吗?
【问题讨论】:
-
崩溃是什么错误
-
对不起,它说:'致命错误:在展开可选值时意外发现 nil'
-
好吧,这一行无法分辨,但看起来您正在尝试使用其中包含
nil的东西 -
但它在模拟器上运行良好,只是在 iPhone 上不行?
标签: swift uiviewcontroller storyboard ios-simulator