Skip to content
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

iphone iOS16.0+ SFAppAutoFillPasswordViewController bug #1932

Closed
fanxiangyang opened this issue Dec 26, 2022 · 6 comments
Closed

iphone iOS16.0+ SFAppAutoFillPasswordViewController bug #1932

fanxiangyang opened this issue Dec 26, 2022 · 6 comments

Comments

@fanxiangyang
Copy link

Describe the bug

Application tried to present modally a view controller <_SFAppAutoFillPasswordViewController: 0x10d41e190> that is already being presented by <UIKeyboardHiddenViewController_Autofill: 0x10d633960>.

Last Exception Backtrace:
0   CoreFoundation                	0x1ac8e9e88 __exceptionPreprocess + 164 (NSException.m:202)
1   libobjc.A.dylib               	0x1a5c1f8d8 objc_exception_throw + 60 (objc-exception.mm:356)
2   UIKitCore                     	0x1aedc4898 -[UIViewController _presentViewController:withAnimationController:completion:] + 4080 (UIViewController.m:0)
3   UIKitCore                     	0x1aee3a4e4 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke_2 + 56 (UIViewController.m:8979)
4   UIKitCore                     	0x1aeace564 +[UIView(Animation) performWithoutAnimation:] + 76 (UIView.m:14722)
5   UIKitCore                     	0x1aedc3860 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 208 (UIViewController.m:8977)
6   UIKitCore                     	0x1aede71cc -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 240 (UIViewControllerTransitioning.m:1148)
7   UIKitCore                     	0x1aed54f58 -[_UIViewControllerTransitionContext _runAlongsideCompletions] + 140 (UIViewControllerTransitioning.m:380)
8   UIKitCore                     	0x1aed53fe8 -[_UIViewControllerTransitionContext completeTransition:] + 128 (UIViewControllerTransitioning.m:292)
9   UIKitCore                     	0x1aed55148 -[UITransitionView notifyDidCompleteTransition:] + 180 (UITransitionView.m:280)
10  UIKitCore                     	0x1aed54d48 -[UITransitionView _didCompleteTransition:] + 828 (UITransitionView.m:249)
11  UIKitCore                     	0x1afad1334 __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 36 (UIView.m:15066)
12  UIKitCore                     	0x1aeb6e808 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 636 (UIView.m:15099)
13  UIKitCore                     	0x1aeb6d764 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 436 (UIView.m:0)
14  UIKitCore                     	0x1aeb6ce84 -[UIViewAnimationState animationDidStop:finished:] + 196 (UIView.m:2297)
15  UIKitCore                     	0x1aeb6cf98 -[UIViewAnimationState animationDidStop:finished:] + 472 (UIView.m:2316)
16  QuartzCore                    	0x1adf80fec CA::Layer::run_animation_callbacks(void*) + 232 (CALayer.mm:7284)
17  libdispatch.dylib             	0x1b3eb9fdc _dispatch_client_callout + 20 (object.m:560)
18  libdispatch.dylib             	0x1b3ec87f4 _dispatch_main_queue_drain + 928 (inline_internal.h:2632)
19  libdispatch.dylib             	0x1b3ec8444 _dispatch_main_queue_callback_4CF + 44 (queue.c:7887)
20  CoreFoundation                	0x1ac97a6f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
21  CoreFoundation                	0x1ac95c058 __CFRunLoopRun + 2036 (CFRunLoop.c:3147)
22  CoreFoundation                	0x1ac960ed4 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
23  GraphicsServices              	0x1e5c62368 GSEventRunModal + 164 (GSEvent.c:2196)
24  UIKitCore                     	0x1aee3f3d0 -[UIApplication _run] + 888 (UIApplication.m:3745)
25  UIKitCore                     	0x1aee3f034 UIApplicationMain + 340 (UIApplication.m:5335)
26  Lovely                        	0x102f9f6b8 main + 88 (main.m:17)
27  dyld                          	0x1cafcc960 start + 2528 (dyldMain.cpp:1170)

and UI ViewController

12-25 16:03:39.833 [ CRLoginVC ] WillAppear
--
1012-25 16:03:41.618 [ UIEditingOverlayViewController ] WillAppear
1112-25 16:03:41.633 [ UISystemKeyboardDockController ] WillAppear
1212-25 16:03:41.636 [ UICompatibilityInputViewController ] WillAppear
1312-25 16:03:41.636 [ UICompatibilityInputViewController ] WillAppear
1412-25 16:03:41.642 [ UICompatibilityInputViewController ] WillAppear
1512-25 16:03:41.644 [ UISystemKeyboardDockController ] WillAppear
1612-25 16:03:53.251 [ UIKeyboardHiddenViewController_Autofill ] WillAppear
1712-25 16:03:53.340 [ UIKeyboardHiddenViewController_Autofill ] WillAppear
1812-25 16:03:53.495 [ _SFAppAutoFillPasswordViewController ] WillAppear
1912-25 16:03:53.499 [ UISystemKeyboardDockController ] WillAppear
2012-25 16:03:53.503 [ SFPasswordPickerRemoteViewController ] WillAppear

To Reproduce
Steps to reproduce the behavior:

  1. only iphone found not all iphone ,ipad not fond,
  2. iOS16+ fond
  3. iphone 11 iphone 12 iphone 13 iphone14 fond
@Akki9326
Copy link

I got the same issue, did you find any work around, @fanxiangyang ?

@fanxiangyang
Copy link
Author

I got the same issue, did you find any work around, @fanxiangyang ?

The violence has been solved. There is a problem with the tripartite database and the system

#import "UIViewController+PresentKBHook.h"

@implementation UIViewController (PresentKBHook)

+ (void)load {
    [UIViewController ff_swizzleInstanceMethodWithSrcClass:[UIViewController class] srcSel:@selector(presentViewController:animated:completion:) swizzledSel:@selector(cr_presentViewController:animated:completion:)];
}

- (void)cr_presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
    if (self.presentedViewController) {
        NSLog(@"[present devil]self=%@,toPresent=%@",self.description, viewControllerToPresent.description);
    }else{
        [self cr_presentViewController:viewControllerToPresent animated:flag completion:completion];
    }
}

/**
 Implementation of exchanging two object methods
 */
+ (void)ff_swizzleInstanceMethodWithSrcClass:(Class)srcClass
                                      srcSel:(SEL)srcSel
                                 swizzledSel:(SEL)swizzledSel{
    
    Method srcMethod = class_getInstanceMethod(srcClass, srcSel);
    Method swizzledMethod = class_getInstanceMethod(srcClass, swizzledSel);
    if (!srcClass || !srcMethod || !swizzledMethod) return;
    
    //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);
    }
}

@end

@rathes38
Copy link

rathes38 commented Mar 8, 2023

@fanxiangyang - I'm using IQKeyboardManager and experiencing the above crashes. Tried to fix it with above code. Crash is not happening with above code but not able to see the keyboard.

Could you please resolve it?

@fanxiangyang
Copy link
Author

fanxiangyang commented Mar 13, 2023

@fanxiangyang - I'm using and experiencing the above crashes. Tried to fix it with above code. Crash is not happening with above code but not able to see the keyboard.IQKeyboardManager

Could you please resolve it?

you can try it ,i not test it

- (void)cr_presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
    if (self.presentedViewController) {
        CRLog(@"[present恶魔]self=%@,toPresent=%@",self.description, viewControllerToPresent.description);
        UIViewController *viewController = self;
        while (viewController.presentedViewController)
        {
            viewController = viewController.presentedViewController;
        }
        [viewController cr_presentViewController:viewControllerToPresent animated:flag completion:completion];
    }else{
        [self cr_presentViewController:viewControllerToPresent animated:flag completion:completion];
    }
}

@zhanghaibo6488
Copy link

Do you have a perfect solution?

@hackiftekhar
Copy link
Owner

It looks like this issue is not related to the library directly and it's related to something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants