In my case the function was not expecting an argument but the button was configured to send one causing the error. To fix this I had to rewire the event handler.
Here is my function:
![enter image description here][1]
Notice it contains no arguments.
Here is an image of my button configuration (right click on the button to view it):
![enter image description here][2]
Notice there are 3 event handlers.
To fix this I had to remove each of the event items since one of them was sending a reference to itself to the enterPressed function. To remove these items I clicked on the little x icon next to the name of each item until there were no items shown.
![enter image description here][3]
Next I had to reconnect the button to the event. To do this hold down the Control key and then drag a line from the button to the action. It should say "Connect Action". Note: I had to restart XCode for this to work for some reason; otherwise it only let me insert actions (aka create a new action) above or below the function.
![enter image description here][4]
You should now have a single event handler wired to the button event that passes no arguments:
![enter image description here][5]
This answer compliments the answer by @Leonard Challis which you should read as well.
[1]:
[2]:
[3]:
[4]:
[5]: