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

Crash on 'NSInvalidArgumentException' of 'NSLayoutConstraint' in 'Document not recognized' alert. #401

Open
ireshetnikov24 opened this issue Sep 13, 2023 · 10 comments

Comments

@ireshetnikov24
Copy link

ireshetnikov24 commented Sep 13, 2023

  • Xcode version: 14.3.1
  • BlinkID SDK version: 6.2.0
  • What are you trying to scan: Production case, no information.

Step 3: Describe the problem

Application crashed twice during last 30 days. It seems like user tried to scan something what wasn't recognised.

Affected devices: iPhone 1, iPhone 14 Pro Max.
OS Versions: 16.6, 16.6.1

Stacktrace:

OS Version: iOS 16.6.1 (20G81)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 0

Application Specific Information:
NSLayoutConstraint for <NSLayoutXAxisAnchor:0x28089bd00 "MBBaseAlertViewController:0x115c09150'Dokument nicht erkannt'.leading">: A constraint cannot be made from <NSLayoutXAxisAnchor:0x28089bd00 "MBBaseAlertViewController:0x115c09150'Dokument nicht erkannt'.leading"> to a constant. Location anchors require being paired.

Thread 0 Crashed:
0   CoreFoundation                  0x32e3b3cb4         __exceptionPreprocess
1   libobjc.A.dylib                 0x3204cc3cc         objc_exception_throw
2   CoreAutoLayout                  0x368d45468         +[NSLayoutConstraint constraintWithAnchor:relatedBy:toAnchor:multiplier:constant:]
3   BlinkID                         0x1129a9b0c         NSMutableAttributedString.init
4   libdispatch.dylib               0x33cd4b32c         _dispatch_continuation_pop
5   libdispatch.dylib               0x33cd5e904         _dispatch_source_invoke
6   libdispatch.dylib               0x33cd565f4         _dispatch_main_queue_drain
7   libdispatch.dylib               0x33cd562f0         _dispatch_main_queue_callback_4CF
8   CoreFoundation                  0x32e442c24         __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
9   CoreFoundation                  0x32e42455c         __CFRunLoopRun
10  CoreFoundation                  0x32e4293e8         CFRunLoopRunSpecific
11  GraphicsServices                0x3a4ed3358         GSEventRunModal
12  UIKitCore                       0x332824f54         -[UIApplication _run]
13  UIKitCore                       0x332824bb8         UIApplicationMain
14  Vergleiche                      0x20095c434         main (AppDelegate.swift:17)
15  <unknown>                       0x1c6928dec         <redacted>


@MBrizic01
Copy link

Hello @ireshetnikov24, thank you for reaching out and reporting the issue.
Did you manage to reproduce this crash on your side? "Dokument nicht erkannt" should appear when the unsupported document is scanned but not cause the crash. Did you maybe set up a class filter, and accept only specific documents?
We tried different times to reproduce the issue on iPhone 13 and 13 Pro by scanning debit cards instead of identity documents, but every time, the process finished with "Document not supported! message. Feel free to reach out to support@microblink.com, where we can further troubleshoot the issue.

@ireshetnikov24
Copy link
Author

ireshetnikov24 commented Sep 14, 2023

@MBrizic01 No, we only get crash reports from live app.

Today there is one more similar crash:

OS Version: iOS 16.6.1 (20G81)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 0

NSInternalInconsistencyException 
NSMutableAttributedString.init
Impossible to set up layout with view hierarchy unprepared for constraint.

Thread 0 Crashed:
0   CoreFoundation                  0x3156d7cb4         __exceptionPreprocess
1   libobjc.A.dylib                 0x3078003cc         objc_exception_throw
2   Foundation                      0x30a123548         -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
3   UIKitCore                       0x3197d0b2c         __120-[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:]_block_invoke_2
4   UIKitCore                       0x319804b70         -[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:]
5   UIKitCore                       0x3197ea558         -[UIView _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:]
6   UIKitCore                       0x319806aec         -[UIView(UIConstraintBasedLayout) nsli_addConstraint:]
7   UIKitCore                       0x3198066dc         __50-[UIView addConstraints:]_block_invoke
8   CoreAutoLayout                  0x35006ce6c         -[NSISEngine withBehaviors:performModifications:]
9   UIKitCore                       0x319a535a0         -[UIView(UIConstraintBasedLayout) addConstraints:]
10  BlinkID                         0x11675caa4         NSMutableAttributedString.init
11  Sentry                          0x117df8064         __49-[SentrySwizzleWrapper swizzleSendAction:forKey:]_block_invoke_2 (SentrySwizzleWrapper.m:46)
12  UIKitCore                       0x3199f5730         -[UIControl sendAction:to:forEvent:]
13  UIKitCore                       0x3199f50c4         -[UIControl _sendActionsForEvents:withEvent:]
14  UIKitCore                       0x3199f4f68         -[UIButton _sendActionsForEvents:withEvent:]
15  UIKitCore                       0x3199f4b28         -[UIControl touchesEnded:withEvent:]
16  UIKitCore                       0x3198a51bc         -[UIWindow _sendTouchesForEvent:]
17  UIKitCore                       0x3198a4610         -[UIWindow sendEvent:]
18  UIKitCore                       0x3198a38c0         -[UIApplication sendEvent:]
19  UIKitCore                       0x3198a1bac         __dispatchPreprocessedEventFromEventQueue
20  UIKitCore                       0x3198ea884         __processEventQueue
21  UIKitCore                       0x31a55db54         updateCycleEntry
22  UIKitCore                       0x319df9d90         _UIUpdateSequenceRun
23  UIKitCore                       0x31a45e890         schedulerStepScheduledMainSection
24  UIKitCore                       0x31a45ddec         runloopSourceCallback
25  CoreFoundation                  0x3157a1124         __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
26  CoreFoundation                  0x3157ad7b0         __CFRunLoopDoSource0
27  CoreFoundation                  0x3157325e4         __CFRunLoopDoSources0
28  CoreFoundation                  0x3157480d0         __CFRunLoopRun
29  CoreFoundation                  0x31574d3e8         CFRunLoopRunSpecific
30  GraphicsServices                0x38c1f7358         GSEventRunModal
31  UIKitCore                       0x319b48f54         -[UIApplication _run]
32  UIKitCore                       0x319b48bb8         UIApplicationMain
33  Vergleiche                      0x204718434         main (AppDelegate.swift:17)
34  <unknown>                       0x1adc54dec         <redacted>

From breadcrumbs:

ui.lifecycle - 11:56:21 - {
beingPresented: false, 
is_window_rootViewController: false, 
parentViewController: MBRecognizerRunnerViewController, 
screen: MBBlinkIdOverlayViewController, 
window: <C24Core.C24Window: 0x11a86e050; baseClass = UIWindow; frame = (0 0; 390 844); autoresize = W+H; gestureRecognizers = <NSArray: 0x28364a4c0>; layer = <UIWindowLayer: 0x28364a250>>, 
window_isKeyWindow: true, 
window_windowLevel: 0.000000
}

touch - 11:57:55 - dismissButtonPressed {
title: Fertig, 
view: <UIButton: 0x131bedb70; frame = (0 342.333; 270 22); opaque = NO; tintColor = <UIDynamicProviderColor: 0x283f8e4a0; provider = <__NSMallocBlock__: 0x2834329a0>>; layer = <CALayer: 0x283fe5dc0>>
}

@MBrizic01
Copy link

MBrizic01 commented Sep 21, 2023

Hello @ireshetnikov24 , thank you for sharing this with us. Unfortunately, it doesn't help in understanding what may cause the issue. But we also wanted to check if you are presenting the SDK in the full screen. Although iOS handles it quite well, it can sometimes occur that alert controllers can cause an issue when the SDK is not presented in the full screen.

@ireshetnikov24
Copy link
Author

ireshetnikov24 commented Oct 2, 2023

@MBrizic01 not exactly. We're used to present it embedded in another view controller.

So runner controller is added into wrapping controller (due to our project specifics) using this snippet:

    func add(   _ viewController: UIViewController,
                to view: UIView,
                animated: Bool = false) {
        
        addChild(viewController)
        view.addSubview(viewController.view)
        viewController.willMove(toParent: self)
        viewController.view.frame = view.bounds
        viewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        
        if animated {
            view.isUserInteractionEnabled = false
            UIView.animate(withDuration: 1, animations: {
                view.alpha = 1
            }) { _ in
                view.isUserInteractionEnabled = true
                viewController.didMove(toParent: self)
            }
        } else {
            viewController.didMove(toParent: self)
        }
    }

Then wrapping controller is pushed into navigation stack, which is presented in fullscreen.

@MBrizic01
Copy link

Hi @ireshetnikov24, thank you for your response. Could you send support@microblink.com a minimal sample code? You can upload it to G Drive and enable us to access it. We will try to reproduce the issue and understand what is causing it. We suspect it might be due to the embedded VC.

@Vaishnavi610
Copy link

Vaishnavi610 commented Mar 8, 2024

Hi, we also had the same issue, and the application crashed. Firebase crashlytics gives following error:
Fatal Exception: NSInvalidArgumentException
NSLayoutConstraint for <NSLayoutXAxisAnchor:0x281805880 "MBBaseAlertViewController:0x14fea9b50'Document not recognized'.leading">: A constraint cannot be made from <NSLayoutXAxisAnchor:0x281805880 "MBBaseAlertViewController:0x14fea9b50'Document not recognized'.leading"> to a constant. Location anchors require being paired.

xcode version : 15.0
Model: iPhone 13 pro
Blink SDK Branch : master

@ysoftware
Copy link

Same issue happened to us as well.

NSInvalidArgumentException
NSLayoutConstraint for <NSLayoutXAxisAnchor:0x280c81040 "MBBaseAlertViewController:0x1197abc60'Document not recognized'.leading">: A constraint cannot be made from <NSLayoutXAxisAnchor:0x280c81040 "MBBaseAlertViewController:0x1197abc60'Document not recognized'.leading"> to a constant. Location anchors require being paired.

PPBlinkID (= 6.4.0)

@MBrizic01
Copy link

Hello @ysoftware , @Vaishnavi610, and whoever might encounter this issue, we cannot reproduce it internally. Could you update to the latest version, 6.7.1, and confirm whether the problem is ongoing? If so, we will include the internal team to investigate it further. Thank you

@ysoftware
Copy link

We have upgraded to 6.7.1 and I can now confirm that the issue persists.

@mparadina
Copy link
Contributor

Hi @ysoftware and @Vaishnavi610

It would be really helpful for us if you could create a minimal sample application with the SDK and how you are presenting it, as are not able to reproduce the reported crash on our end.

If sharing your implementation is not an option here, you can contact us directly at support@microblink.com

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