“Unrecognized selector sent to instance” in swift

后端 未结 10 504
刺人心
刺人心 2020-12-10 10:36

I have no idea what I am doing wrong. I am also quite new to programming so I am not very good at debugging. This was a test app so that I can see how swift ties in with app

10条回答
  •  温柔的废话
    2020-12-10 11:30

    Adding an @IBAction function to your code and then deleting or renaming it without updating your storyboard will also cause this error.

    Look at the selector in the error message:

    '-[HelloWorld.ViewController yourActionFunction:]: unrecognized selector sent to instance 0x157e0c830'
                                 ^^^^^^^^^^^^^^^^^^
    

    Do you have a function named yourActionFunction? If not, select the storyboard and edit the connections on your control (e.g. button).

提交回复
热议问题