【问题标题】:iOS autofill causes crash while click "key button"(over keyboard)iOS 自动填充在单击“按键按钮”(通过键盘)时导致崩溃
【发布时间】:2023-02-13 16:38:09
【问题描述】:

*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“应用程序试图以模态方式呈现一个视图控制器 <_SFAppAutoFillPasswordViewController: 0x106e22ee0>,它已经由 <UIKeyboardHiddenViewController_Autofill: 0x106e25a10> 呈现。”

IOS16(不确定其他操作系统版本是否可以重现) 单击文本字段,然后键盘显示(上面有一个键按钮),单击键按钮,它随机崩溃。

【问题讨论】:

  • 关于这个问题的任何更新?我们每天都在崩溃报告中看到,但无法重现。

标签: ios crash textfield autofill passkey


【解决方案1】:

//IQKeyBoardManager IssuesThe violence has been solved. There is a problem with the tripartite database and the system

#import "UIViewController+PresentKBHook.h"

@implementation UIViewController (PresentKBHook)

  • (无效)加载{ [UIViewController ff_swizzleInstanceMethodWithSrcClass:[UIViewController 类] srcSel:@selector(presentViewController:animated:completion:) swizzledSel:@selector(cr_presentViewController:animated:completion:)]; }
  • (void)cr_presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion { 如果(self.presentedViewController){ NSLog(@"[礼物恶魔]self=%@,toPresent=%@",self.description, viewControllerToPresent.description); }别的{ [self cr_presentViewController:viewControllerToPresent animated:flag completion:completion]; } }

/** Implementation of exchanging two object methods */

  • (无效)ff_swizzleInstanceMethodWithSrcClass:(类)srcClass 源选择:(SEL)源选择 swizzledSel:(SEL)swizzledSel{

    方法 srcMethod = class_getInstanceMethod(srcClass, srcSel); 方法 swizzledMethod = class_getInstanceMethod(srcClass, swizzledSel); 如果(!srcClass ||!srcMethod ||!swizzledMethod)返回;

    //Add a layer of protection measures. If the method is added successfully, it means that the method does not exist in this class, but exists in the parent class, and the method of the parent class cannot be exchanged, otherwise the method will crash when the parent class object calls the method; Adding failure indicates that the method exists in this class BOOL addMethod = class_addMethod(srcClass, srcSel, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)); if (addMethod){ //After the IMP is successfully implemented by adding methods, the original implementation will be replaced with the swizzledMethod method to achieve method exchange without affecting the implementation of the parent method class_replaceMethod(srcClass, swizzledSel, method_getImplementation(srcMethod), method_getTypeEncoding(srcMethod)); }else{ //Adding failed, calling the implementation of the two interactive methods method_exchangeImplementations(srcMethod, swizzledMethod); } }

@结尾

【讨论】:

    猜你喜欢
    • 2011-09-15
    • 1970-01-01
    • 2016-02-07
    • 2019-07-07
    • 1970-01-01
    • 2020-06-19
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    相关资源
    最近更新 更多