I'm using DAKeyboardControll
on my app .
it has a method with name : swizzled_addSubview
and implement Like this:
- (void)swizzled_addSubview:(UIView *)subview
{
if (!subview.inputAccessoryView)
{
if ([subview isKindOfClass:[UITextField class]])
{
UITextField *textField = (UITextField *)subview;
if ([textField respondsToSelector:@selector(setInputAccessoryView:)])
{
UIView *nullView = [[UIView alloc] initWithFrame:CGRectZero];
nullView.backgroundColor = [UIColor clearColor];
textField.inputAccessoryView = nullView;
}
}
else if ([subview isKindOfClass:[UITextView class]]) {
UITextView *textView = (UITextView *)subview;
if ([textView respondsToSelector:@selector(setInputAccessoryView:)] && [textView respondsToSelector:@selector(isEditable)] && textView.isEditable)
{
UIView *nullView = [[UIView alloc] initWithFrame:CGRectZero];
nullView.backgroundColor = [UIColor clearColor];
textView.inputAccessoryView = nullView;
}
}
}
[self swizzled_addSubview:subview];
}
problem
recently in my new version that compatible with AutoLayout , i receive some crash on this method , and reasons of them :
-[UIView(DAKeyboardControl) swizzled_addSubview:]
,
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE at 0x0090dffc
i know this problem has happened for many many call , but why it can't work correctly ?
this crash happened only for 8 users for 54 times , 50 % of them has a jailbreak Device , but another person has a non- jailbreak Device !