2

I spent a while searching for the answer for this question on google and managed to stumble across the answer myself and thought I would share it.

I was getting the “Unrecognized Selector Sent to Instance” Error. I traced it to my button.

What I had done with out realising is assigned two methods to a button. I had made a method and linked it to the button. I then deleted that method made another one and linked it to the button. I didnt realise that the button was still linked and looking to run the old method that was no longer there.

4

4 回答 4

6

只需转到您的xib,选择按钮,然后在connectionInspector (cmd + option + 6)中删除您以前的连接。

于 2012-10-08T14:46:57.267 回答
4

To solve this is quite easy. Go on the your storyboard and right click on the button. It will display a list that shows what method it is linked to. If there is more that one there delete all the others that you dont want. This should get rid of that message.

Another thing to note was I was getting a warning that my method had incomplete implementation. I didnt know why that was at the time but it was because there where button methods that werent being implemented.

于 2012-10-08T14:21:24.937 回答
2

我遇到了同样的问题,意识到:如果你删除了一个函数,在 Interface Builder 中指向它的链接仍然存在,你必须手动删除它们,否则它们将链接到不存在的函数并引发一个运行时错误。

于 2013-11-10T03:56:36.653 回答
0

我刚刚删除了主故事板中的按钮和视图控制器之间的连接。然后我将 IBAction-code-snippet 连接到按钮。那行得通。

于 2021-11-05T08:50:11.570 回答