当我启动我的应用程序并单击该按钮时,该应用程序与fatal error: unexpectedly found nil while unwrapping an Optional value
崩溃,但当我再次启动模拟器时,单击它时一切正常。
这是按钮执行的代码:
func showProfile(sender:AnyObject?){
let profile = App.mainStoryboard.instantiateViewControllerWithIdentifier("profile") as! Profile
//Here is the error
animateToView(self.navigationController!, view: profile, midX: self.profileItem.frame.midX, midY: self.profileItem.frame.midY)
}
答案 0 :(得分:1)
我认为问题出在你的navigationController
if let _ = self.navigationController {
animateToView(self.navigationController!, view: profile, midX: self.profileItem.frame.midX, midY: self.profileItem.frame.midY)
}