为了做这个
if #available(iOS 8, *) {
self.presentViewController(SomeViewController(nibName: "SomeViewController", bundle: nil), animated: true, completion: nil)
} else {
self.presentViewController(SomeViewController(), animated: true, completion: nil)
}
或只是
self.presentViewController(SomeViewController(nibName: "SomeViewController", bundle: nil), animated: true, completion: nil)
出于某种原因的iOS 8不是对包括nibName在初始化与它的相应一流的自动化解决这个问题,我们需要版本检查。
更新:
也可以通过这样
class SomeViewController: UIViewController {
init() {
super.init(nibName: "SomeViewController'sNibNameHere", bundle: nil)
}
}
// on some other part of your code
self.presentViewController(SomeViewController(), animated: true, completion: nil)
什么是崩溃日志固定的吗? –
@AhmadF'致命错误:意外地发现零,同时展开一个可选值'我已经修复它,但我的答案在下面。这很奇怪,为什么会发生这种情况 –