项目里有接入通联支付,遇到一bug:进入快捷签约界面后,无论点哪里输入都弹出一个选择证件类型框,没法输入.
在更换了最新的通联SDK2.5.2,检查订单数据的正确性,跑他们DEMO.发现在DEMO上是正常的,但接入我们的工程里就出现了上述问题.
看了通联的界面上弹出的键盘上的东西,和IQKeyboardManager的风格很相似.
而我们的项目里面有使用了IQKeyboardManager第三方库,于是便把我们工程里的IQKeyboardManager第三方库去掉后,问题 (快捷签约界面,无论点哪里输入都弹出一个选择证件类型框,没法输入)就没有了.我觉得有可能通联的SDK里有使用了类似的键盘第三方库,导致了这个bug.
因此如果项目里面已经集成了IQKeyboardManager第三方库,但又要集成通联支付,那么慎重!!!
目前想到的暂时的解决办法就是改IQKeyboardManager源代码:
在进入到通联支付界面之前,先enable=NO,完事在=YES.
- (void)registerNotify
{
// Registering for keyboard notification.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];
// Registering for textField notification.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidBeginEditing:) name:UITextFieldTextDidBeginEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidEndEditing:) name:UITextFieldTextDidEndEditingNotification object:nil];
// Registering for textView notification.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidBeginEditing:) name:UITextViewTextDidBeginEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidEndEditing:) name:UITextViewTextDidEndEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidChange:) name:UITextViewTextDidChangeNotification object:nil];
// Registering for orientation changes notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willChangeStatusBarOrientation:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
}
- (void)resignNotify
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
/* Automatically called from the `+(void)load` method. */
+ (instancetype)sharedManager
{
//Singleton instance
static IQKeyboardManager *kbManager;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
kbManager = [[self alloc] init];
});
return kbManager;
}
#pragma mark - Dealloc
-(void)dealloc
{
// Disable the keyboard manager.
[self setEnable:NO];
//Removing notification observers on dealloc.
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - Property functions
-(void)setEnable:(BOOL)enable
{
// If not enabled, enable it.
if (enable == YES && _enable == NO)
{
//Setting NO to _enable.
_enable = enable;
[self registerNotify];
//If keyboard is currently showing. Sending a fake notification for keyboardWillShow to adjust view according to keyboard.
if (_kbShowNotification) [self keyboardWillShow:_kbShowNotification];
_IQShowLog(IQLocalizedString(@"enabled", nil));
}
//If not disable, desable it.
else if (enable == NO && _enable == YES)
{
//Sending a fake notification for keyboardWillHide to retain view's original frame.
[self keyboardWillHide:nil];
//Setting NO to _enable.
_enable = enable;
[self resignNotify];
_IQShowLog(IQLocalizedString(@"disabled", nil));
}
//If already disabled.
else if (enable == NO && _enable == NO)
{
_IQShowLog(IQLocalizedString(@"already disabled", nil));
}
//If already enabled.
else if (enable == YES && _enable == YES)
{
_IQShowLog(IQLocalizedString(@"already enabled", nil));
}
}