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
App dies in [self swizzled_addSubview:subview]; #25
Comments
+1 |
5352d1f has resolved this issue. |
It's still an issue for me, even with the changes from 5352d1f |
Same here, for me it happened when I was presenting a modal view controller from a navigation controller. |
Using 2.1.0 and getting crashes after loading DAKeyboardControl the second time. Getting messages being sent to deallocated instances.
Hacky fix by calling |
Reproducible demo of the crash: |
@emersonmalca, you need to remove keyboard control when your view goes away. This isn't an issue with DAKeyboardControl. diff --git a/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m b/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m
index 3042579..8078d6a 100644
--- a/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m
+++ b/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m
@@ -97,4 +97,8 @@
[self dismissViewControllerAnimated:YES completion:NULL];
}
+- (void)dealloc {
+ [[self view] removeKeyboardControl];
+}
+
@end |
thanks @kylef, so the comment in the demo in the action handler block is no valid anymore then, since calling that method is not optional: /* |
Yeah I should make it more explicit that Of course, at the same time I would like to hunt down exactly why not removing But yes, balancing the calls will fix this issue. Thanks @emersonmalca for the great demo, and @kylef again. |
Was also confused as that comment makes it look optional (only required if you have a retain cycle?) Figured that wasn't the case. :) |
Any updated here? We really want to use this control but it crashes in IOS7 |
same for me. |
Same thing here. Also see a lot of crash reports related to that issue.
|
Thanks +- (void)dealloc {
Worked for me :) |
It is happening for ios 7 and ios 8. I have tried with this also.
is there any way that swizzled_addSubview will not be called it instance is deallocated |
We see this crash in our application as well. We do indeed call
|
I am suspecting that this crash is not related to Of course I could be wrong, but this is what our research came up with. |
@joshuafeldman your suspicion is correct in my case. The crash is indirectly triggered by another bug in a different part of the code. Basically, my view shouldn't have been deallocated, and calling removeKeyboardControl on this view crashed the app. |
Hi |
Finally figured this one out, and it was really difficult. It seems like some of the views in the Apple keyboard window don't actually respond to What we did to work around the bug is create a category on |
@joshuafeldman i can't understand completely your last comment. |
is there any respond to my question ? |
@mfarhand we ended up removing But while we had it implemented we used something like this to prevent that bug where a weird subclass of
@implementation UIResponder (KeyboardViewResponderFix)
+ (void)load
{
SEL originalSelector = @selector(isFirstResponder);
SEL swizzledSelector = @selector(swizzled_isFirstResponder);
[self swizzleInstanceMethod:swizzledSelector toMethod:originalSelector];
}
- (BOOL)swizzled_isFirstResponder
{
if ( [self respondsToSelector:@selector(swizzled_isFirstResponder)] ) {
return [self swizzled_isFirstResponder];
}
return NO;
}
@end |
@joshuafeldman thanks for your reply
what is the best solution for handle without this library?(we we to set out table view on top of keyboard frame & dismiss it with panning gesture |
@mfarhand yes if you have your own method to swizzle just use it there. If your applications supports iOS 7+ I highly suggest looking at https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScrollView_Class/#//apple_ref/occ/instp/UIScrollView/keyboardDismissMode |
@joshuafeldman tnx for your help , i will try it and notify you about this issue. |
Hi there,
I was trying to use DAKeyboardControl, but my App crashes after the second load of DAKeyboardControl.
To show what I mean, I modified the Example project. You can find it here:
https://github.com/appcominteractive/DAKeyboardControl/tree/swizzeledError
To see the crash: push the new push button, go back, and press the push button again.
Tested with Xcode 4.5.2 on iPhone 5.0 and iPhone 6.0 Simulator.
Regards,
Christian
The text was updated successfully, but these errors were encountered: