Recently began to learn iOS development, and today followed the Stanford public class to write the calculator code encountered the following error:
2015-03-15 20:18:18.442 calculater[1185:66564]-[calculater. Viewcontroller operator:]: Unrecognized selector sent to instance 0x7ffb1875b220
2015-03-15 20:18:18.453 calculater[1185:66564] * * * terminating app due to uncaught exception ' Nsinvalidargumentexception ', Reason: '-[calculater. Viewcontroller operator:]: Unrecognized selector sent to instance 0x7ffb1875b220 '
First throw Call stack:
... ... (Omitted here)
Libc++abi.dylib:terminating with uncaught exception of type NSException
After discovering the error I have been with the video on the code is relatively different, the code is not very big difference, the Internet to check that the source of the error can be seen from this: [Calculater. Viewcontroller Operator:]
And then I was looking for "operator", but I didn't define "operator" in my Code.
Finally, I found that when I first declared the button's action, I defined the action named operator, but then operator is the keyword, I cannot use it, and after I redefine the name of the action, the action of the button is still bound to a "operator". After you delete this binding, the program will run normally.
Problems and solutions for swift IOS development