swift - SIGABRT Error when trying to switch to second view -


i want switch main story board second view controller. code tried use is

func countcheck(){     if rightanswercount + wronganswercount == 10{          let secondviewcontroller = self.storyboard?.instantiateviewcontroller(withidentifier: "secondviewcontroller") as! secondviewcontroller          self.navigationcontroller?.pushviewcontroller(secondviewcontroller, animated: true)     } } 

when rightanswercount + wronganswercount == 10, program crashed , showed sigabrt error , when scrolled through nslog, states "reason: 'storyboard () doesn't contain view controller identifier 'secondviewcontroller''"

there view called secondviewcontroller don't understand why didn't switch view, should do?

storyboard doesn't contain view controller identifier <youridentifiername> error means didn't set storyboard id corresponding name.

  1. go storyboard;
  2. open inspector view controller;
  3. set storyboard id <youridentifiername>.

enter image description here


Comments