domesticcatsoftware / DCRoundSwitch

A 'modern' replica of UISwitch.
MIT License
765 stars 162 forks source link

Code is crashing when trying to call the selector #23

Open tdahbura opened 12 years ago

tdahbura commented 12 years ago

[self.switch1 addTarget:self action:@selector(switch1Toggled:) forControlEvents:UIControlEventValueChanged];

When this line is enabled in the code and you click on the switch it crashes in the simulator to assembly code, once the debugger dropped a message that an invalid selector was being called.

This was the code for the selector:

I am using Xcode 4.4.1 with iOS 5.1 simulator.

Here is a dump log: 2012-08-17 19:37:41.565 DCRoundSwitchDemo[1654:c07] -[NSCFString switch1Toggled:]: unrecognized selector sent to instance 0x6a8f580 2012-08-17 19:37:41.568 DCRoundSwitchDemo[1654:c07] *\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString switch1Toggled:]: unrecognized selector sent to instance 0x6a8f580' *\ First throw call stack: (0x1379022 0x106ecd6 0x137acbd 0x12dfed0 0x12dfcb2 0x137ae99 0x1d414e 0x1d40e6 0x27aade 0x27afa7 0x27ab13 0x754e 0x2128330 0x212a509 0x12b0803 0x12afd84 0x12afc9b 0x21847d8 0x218488a 0x1d1626 0x2bdd 0x2b55 0x1) terminate called throwing an exception(lldb)

I am getting this if two buttons are pointing to the same selector, or it appears by simply adding a new button with a new selector....All this work is in the sample app that comes with the kit.

Thanks, Tony