ios - XCode 6: I can't select a view by its storyboard ID -
this code :
let theboard = self.storyboard! let vc = theboard.instantiateviewcontrollerwithidentifier("myviewid") as! uiviewcontroller // line causes error the second line causes error:
unexpectedly found nil while unwrapping optional value * important * : error fires when build configuration set "debug". works when set "release".
why ?
you casting uiviewcontroller in let vc = theboard.instantiateviewcontrollerwithidentifier("myviewid") as! uiviewcontroller wrong. should try:
var storyboard = uistoryboard(name: "main", bundle: nil) var vc = storyboard.instantiateviewcontrollerwithidentifier("myviewid") as! viewcontroller
Comments
Post a Comment