DOFavoriteButton icon indicating copy to clipboard operation
DOFavoriteButton copied to clipboard

When I clicked on the button, there was an error.

Open rongloveyan opened this issue 8 years ago • 3 comments

2016-04-13 18:29:02.168 DOFavoriteButton-DEMO[1303:41281] -[DOFavoriteButton.DOFavoriteButton select:]: unrecognized selector sent to instance 0x7fd032c361b0 2016-04-13 18:29:02.172 DOFavoriteButton-DEMO[1303:41281] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DOFavoriteButton.DOFavoriteButton select:]: unrecognized selector sent to instance 0x7fd032c361b0' *** First throw call stack: ( 0 CoreFoundation 0x000000010e415d85 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000110881deb objc_exception_throw + 48 2 CoreFoundation 0x000000010e41ed3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010e364cfa __forwarding + 970 4 CoreFoundation 0x000000010e3648a8 _CF_forwarding_prep_0 + 120 5 DOFavoriteButton 0x0000000110cc6215 TFC16DOFavoriteButton16DOFavoriteButton6selectfT_T + 69 6 DOFavoriteButton-DEMO 0x000000010e22f4d3 TFC21DOFavoriteButton_DEMO14ViewController12tappedButtonfC16DOFavoriteButton16DOFavoriteButtonT + 99 7 DOFavoriteButton-DEMO 0x000000010e22f52a TToFC21DOFavoriteButton_DEMO14ViewController12tappedButtonfC16DOFavoriteButton16DOFavoriteButtonT + 58 8 UIKit 0x000000010f307a8d -[UIApplication sendAction:to:from:forEvent:] + 92 9 UIKit 0x000000010f47ae67 -[UIControl sendAction:to:forEvent:] + 67 10 UIKit 0x000000010f47b143 -[UIControl _sendActionsForEvents:withEvent:] + 327 11 UIKit 0x000000010f47a263 -[UIControl touchesEnded:withEvent:] + 601 12 UIKit 0x000000010f37a99f -[UIWindow _sendTouchesForEvent:] + 835 13 UIKit 0x000000010f37b6d4 -[UIWindow sendEvent:] + 865 14 UIKit 0x000000010f326dc6 -[UIApplication sendEvent:] + 263 15 UIKit 0x000000010f300553 _UIApplicationHandleEventQueue + 6660 16 CoreFoundation 0x000000010e33b301 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 17 CoreFoundation 0x000000010e33122c __CFRunLoopDoSources0 + 556 18 CoreFoundation 0x000000010e3306e3 __CFRunLoopRun + 867 19 CoreFoundation 0x000000010e3300f8 CFRunLoopRunSpecific + 488 20 GraphicsServices 0x0000000113edbad2 GSEventRunModal + 161 21 UIKit 0x000000010f305f09 UIApplicationMain + 171 22 DOFavoriteButton-DEMO 0x000000010e2303b2 main + 114 23 libdyld.dylib 0x000000011136592d start + 1 24 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

rongloveyan avatar Apr 13 '16 10:04 rongloveyan

I guess the problem here is the implementation of select is calling another method called select: of UIResponder (since UIButton is one of its subclasses).

To resolve the issue for now, you may try to call select(animate:) instead:

// for Objective-C
[myButton selectWithAnimate: YES];
// for Swift
myButton.select(animate: true)

cyhsutw avatar Apr 13 '16 11:04 cyhsutw

Thank you!

iThanh avatar Apr 14 '16 11:04 iThanh

@cyhsutw I can't add the animate:true to the select?

galharth avatar Jul 17 '16 21:07 galharth