[SWIFT] The unrecognized selector sent to instance error also appears at this time.

Introduction

I was writing code that created a button and did some processing when pressed. The build was working, but as soon as I pressed the button, it didn't do that and I got a unrecognized selector sent to instance error. I had a hard time solving this, so I'll leave a note. button_error.gif

It was a different cause from this one. https://qiita.com/yoshiki-0428/items/80ea88f65f5a62ffcc11

Cause

Look at the yellow triangle (danger mark) on the right side of the screen. Two @IBActions are linked to one button. This is the cause. Screenshot 2020-12-27 10.32.36 (2) .png

approach

I was having trouble releasing this link. The reason is that even if you delete the code, it will not be released until you delete the link with the yellow mark. スクリーンショット 2020-12-27 10.33.54.png

(Supplement) I referred to this article for how to check the association. https://teratail.com/questions/46087

Summary

I wrote it because there are few articles on swift that I killed for the first time. I wrote it with warm eyes because I was afraid that I would be told "Don't write Kita because of this!" .. ..

Recommended Posts

The unrecognized selector sent to instance error also appears at this time.
What to do if you get the error message unrecognized selector send to instance "***"
About the behavior at the time of error of Files.copy (pathA, pathB)
Setting to start multiple units at the same time with Vagrant
[Rails] About Uglifier :: Error: Unexpected token: at the time of deployment