what does Error “Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)” mean?

后端 未结 10 1064
情歌与酒
情歌与酒 2020-11-29 02:42

I got this error:

Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

How can I solve this? The code works normally,

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 03:31

    This line

    secondNumber = Screen.text!.toInt()!
    

    means: Get the Screen object, get the text property and please crash if it doesn't exist, then get the text converted to an integer, and please crash if it doesn't exist.

    That's what the ! means: "I am sure this thing exists, so please crash if it doesn't". And crash is what it did.

提交回复
热议问题