Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crash on tap #38

Closed
idoodler opened this issue Nov 15, 2014 · 5 comments
Closed

Application crash on tap #38

idoodler opened this issue Nov 15, 2014 · 5 comments

Comments

@idoodler
Copy link

Hi, I am using MGSwipeTableCell I my application. Since I am using iOS 8 I am having issues. Sometimes it crashes my app. When I press on one of the button my app randomly crashes. I tried to set a breakpoint at
"-(BOOL)swipeTableCell:(MGSwipeTableCell*) cell tappedButtonAtIndex:(NSInteger) index direction:(MGSwipeDirection)direction fromExpansion:(BOOL) fromExpansion;" but when I set a breakpoint nothing crashes. Then I added an "NSLog();" and I saw, that it crashes before calling that delegate methode.

Sometimes there is no exception in the console, but sometimes there is the following message in the console.

2014-11-15 15:20:39.792 MyApp[2566:133071] -[**NSCFType buttonClicked:]: unrecognized selector sent to instance 0x7fa19db67f00
2014-11-15 15:20:39.798 MyApp[2566:133071] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType buttonClicked:]: unrecognized selector sent to instance 0x7fa19db67f00'
* First throw call stack:
(
0 CoreFoundation 0x000000010f3a0f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010f77cbb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010f3a804d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010f30027c __forwarding
+ 988
4 CoreFoundation 0x000000010f2ffe18 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010cde18be -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x000000010cee8410 -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x000000010cee77df -[UIControl touchesEnded:withEvent:] + 522
8 UIKit 0x000000010ce27308 -[UIWindow _sendTouchesForEvent:] + 735
9 UIKit 0x000000010ce27c33 -[UIWindow sendEvent:] + 683
10 UIKit 0x000000010cdf49b1 -[UIApplication sendEvent:] + 246
11 UIKit 0x000000010ce01a7d _UIApplicationHandleEventFromQueueEvent + 17370
12 UIKit 0x000000010cddd103 _UIApplicationHandleEventQueue + 1961
13 CoreFoundation 0x000000010f2d6551 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
14 CoreFoundation 0x000000010f2cc41d __CFRunLoopDoSources0 + 269
15 CoreFoundation 0x000000010f2cba54 __CFRunLoopRun + 868
16 CoreFoundation 0x000000010f2cb486 CFRunLoopRunSpecific + 470
17 GraphicsServices 0x0000000111a459f0 GSEventRunModal + 161
18 UIKit 0x000000010cde0420 UIApplicationMain + 1282
19 MyApp 0x000000010b6ce8af MyApp + 2123951
20 libdyld.dylib 0x0000000111f8a145 start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

@MortimerGoro
Copy link
Owner

I can't reproduce this issue. Can you send me a testcase?

@SebC99
Copy link

SebC99 commented Nov 30, 2014

I have a similar issue, but not random:

  • tap one of the right button, which open a modal
  • cancel the modal to come back to the table view
  • tap the same button again -> crash

The only way I've found to cope with this issue is to define the buttons in prepareForReuse and not in awakeFromNib as I was doing before.

@nrgbodya
Copy link

nrgbodya commented Dec 1, 2014

Have the same issue.

To reproduce the bug I need to scroll the cell out of range so that -prepareForReuse is called and then open the cell and tap left button. The error is always that (buttonClicked:) selector was unrecognized but it is not always sent to NSCFType!! Most often it's being sent to UIPanGestureRecognizer, or I also saw it with UIImageView.

I was just able to make sure (buttonClicked:) selector is being assigned only to UIButtons. It seems the problem to be deeper.

I found out that if I comment out the -prepareForReuse or, as stated by @SebC99, or if I define the buttons again in -prepareForReuse, apart from -initWithStyle, this bug disappears.

@SebC99
Copy link

SebC99 commented Dec 1, 2014

Another solution is to add the swipe buttons through the delegate method. And it's better in term of memory footprint

@MortimerGoro
Copy link
Owner

Fixed ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants