快过年了,最近要上线系统,本来开开心心的 都没什么问题了,结果上线前测试大哥用他专业变态的妓术手段,测出了这个之前被忽略的问题.
经过是这样的:
UITextField 在切换iOS系统手写输入时会出现crash问题,测试机系统版本9.3.1
Xcode调试
崩溃断点停在IQKeyboardManager文件中
显示崩溃原因是
-[UIKBBlurredKeyView candidateList]: unrecognized selector sent to instance 0x13fdca4a0
crash原因:
键盘上的手势和View上的手势冲突了
解决方法:
创建一个UIScrollView的category添加已下方法
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (![self isMemberOfClass:[UIScrollView class]]) {
} else {
[[self nextResponder] touchesBegan:touches withEvent:event];
if ([super respondsToSelector:@selector(touchesBegan:withEvent:)]) {
[super touchesBegan:touches withEvent:event];
}
}
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if (![self isMemberOfClass:[UIScrollView class]]) {
} else {
[[self nextResponder] touchesMoved:touches withEvent:event];
if ([super respondsToSelector:@selector(touchesBegan:withEvent:)]) {
[super touchesMoved:touches withEvent:event];
}
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (![self isMemberOfClass:[UIScrollView class]]) {
} else {
[[self nextResponder] touchesEnded:touches withEvent:event];
if ([super respondsToSelector:@selector(touchesBegan:withEvent:)]) {
[super touchesEnded:touches withEvent:event];
}
}
}