【发布时间】:2015-07-26 02:46:24
【问题描述】:
这是代码:
let theBoard = self.storyboard!
let vc = theBoard.instantiateViewControllerWithIdentifier("myViewId") as! UIViewController // this line causes the error
第二行导致这个错误:
unexpectedly found nil while unwrapping an Optional value
* 非常重要 * :该错误仅在构建配置设置为“debug”时触发。设置为“release”时效果很好。
为什么?
【问题讨论】:
-
你确定当你发布它时会显示一个目标故事板?
-
绝对,在发布时视图显示
-
清理项目并重建
-
做了几次,derivedData也被删除了
-
你确认它不是
theBoard是 nil 吗?
标签: ios objective-c xcode swift storyboard