Swift错误:e​​xc_bad_instruction(code = exc_i386_invop subcode = 0x0)

时间:2016-10-21 22:49:04

标签: ios swift

我已经在网站上查找了我的问题的答案,但我找不到适合我的解决方案。每次在Iphone 5模拟器上运行我的应用程序时,我都会收到错误代码。但我没有得到Iphone 6及以上的错误。为什么是这样?当我按下按钮时它会崩溃,否则一旦我进入第三个屏幕它就会崩溃。

func pickQuestion () {

    if (Questions.count  > 0 ) && (numberWrong < 4 ){
    ***qNum = Int(arc4random()) % Questions.count***
    qLabel.text = Questions[qNum].Question
    answerNum = Questions[qNum].Answer

        for i in 0..<buttons.count {

            buttons[i].setTitle(Questions[qNum].Answers[i], for: UIControlState.normal)
        }
        Questions.remove(at: qNum)

}
    else {

        actioncall()

    }
func actioncall () {
    let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

    let vc: GameOverViewController = storyBoard.instantiateViewController(withIdentifier: "Game Over") as! GameOverViewController
    self.present(vc, animated: true, completion: nil)

}

0 个答案:

没有答案