swiftxcodetestflightcrash-log

How to Determine the Exact Location of Error from CrashLog Obtained from TestFlight


I obtained my crashlog from testflight.

crashlog.crash

Incident Identifier: F9255190-FC14-48E9-8C02-A54D5A410CBE
Beta Identifier:     F6E379C0-91F6-4A43-9CD1-C922ACA4126E
Hardware Model:      iPhone10,2
Process:             ARMail [22660]
Path:                /private/var/containers/Bundle/Application/225B1C6F-91C7-4B8A-B1A8-5ABE9211EE1F/ARMail.app/ARMail
Identifier:          com.BradleyFrench.ARMail
Version:             15 (1.0)
AppStoreTools:       11C29
AppVariant:          1:iPhone10,2:13
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.BradleyFrench.ARMail [4315]


Date/Time:           2020-03-02 16:42:42.7223 -0500
Launch Time:         2020-03-02 16:24:16.7464 -0500
OS Version:          iPhone OS 13.3.1 (17D50)
Release Type:        User
Baseband Version:    5.30.01
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001c3d03aa4
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [22660]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib              0x00000001c3d03aa4 $ss17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_SSAHSus6UInt32VtFTf4xxnnn_n + 440 (AssertCommon.swift:132)
1   libswiftCore.dylib              0x00000001c3d03aa4 $ss17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_SSAHSus6UInt32VtFTf4xxnnn_n + 440 (AssertCommon.swift:132)
2   libswiftCore.dylib              0x00000001c3b2071c $ss17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_SSAHSus6UInt32VtF + 32 (<compiler-generated>:0)
3   DepthCamera                     0x00000001017e911c AVCaptureDevice.selectDepthFormat() + 3488 (AVCaptureDevice+Extension.swift:0)
4   DepthCamera                     0x00000001017fe010 VideoCapture.setupCaptureVideoDevice(with:) + 476 (VideoCapture.swift:186)
5   DepthCamera                     0x00000001017ff858 specialized VideoCapture.init(cameraMode:cameraType:preferredSpec:previewContainer:) + 2020 (VideoCapture.swift:100)
6   DepthCamera                     0x00000001017ebe04 RealtimeDepthMaskViewController.viewDidLoad() + 472 (RealTimeDepthViewController.swift:0)
7   DepthCamera                     0x00000001017ece28 @objc RealtimeDepthMaskViewController.viewDidLoad() + 28 (<compiler-generated>:0)
8   UIKitCore                       0x00000001ba2ad448 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100 (UIViewController.m:2283)
9   UIKitCore                       0x00000001ba2b1f58 -[UIViewController loadViewIfRequired] + 936 (UIViewController.m:3382)
10  UIKitCore                       0x00000001ba2b2360 -[UIViewController view] + 28 (UIViewController.m:3404)
11  UIKitCore                       0x00000001ba1dca24 -[_UIFullscreenPresentationController _setPresentedViewController:] + 80 (_UIFullscreenPresentationController.m:227)
12  UIKitCore                       0x00000001ba1d0434 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 188 (UIPresentationController.m:200)
13  UIKitCore                       0x00000001ba2c1bf8 -[UIViewController _presentViewController:withAnimationController:completion:] + 2528 (UIViewController.m:7283)
14  UIKitCore                       0x00000001ba2c4794 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 104 (UIViewController.m:7731)
15  UIKitCore                       0x00000001ba2c4c90 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 508 (UIViewController.m:7832)
16  UIKitCore                       0x00000001ba2c46e4 -[UIViewController _presentViewController:animated:completion:] + 196 (UIViewController.m:7738)
17  UIKitCore                       0x00000001ba2c494c -[UIViewController presentViewController:animated:completion:] + 160 (UIViewController.m:7776)
18  ARMail                          0x0000000101019508 ObtainVideoViewController.takePicture() + 292 (ObtainVideoViewController.swift:333)
19  ARMail                          0x00000001010297e0 closure #2 in MyImageView.pressedButton() + 216 (MyImageView.swift:115)
20  ARMail                          0x0000000101013c44 thunk for @escaping @callee_guaranteed (@guaranteed UIAlertAction) -> () + 48 (<compiler-generated>:0)
21  UIKitCore                       0x00000001b9f1eed0 -[UIAlertController _invokeHandlersForAction:] + 108 (UIAlertController.m:1075)
22  UIKitCore                       0x00000001b9f1f82c __103-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:dismissC... + 28 (UIAlertController.m:1240)
23  UIKitCore                       0x00000001ba1d0fe0 -[UIPresentationController transitionDidFinish:] + 952 (UIPresentationController.m:462)
24  UIKitCore                       0x00000001ba1d576c __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.503 + 208 (UIPresentationController.m:1086)
25  UIKitCore                       0x00000001ba2d95a8 -[_UIViewControllerTransitionContext completeTransition:] + 100 (UIViewControllerTransitioning.m:285)
26  UIKitCore                       0x00000001bad55d90 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 588 (UIView.m:14023)
27  UIKitCore                       0x00000001bad29c70 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 244 (UIView.m:0)
28  UIKitCore                       0x00000001bad2a178 -[UIViewAnimationState animationDidStop:finished:] + 240 (UIView.m:2219)
29  UIKitCore                       0x00000001bad2a2c8 -[UIViewAnimationState animationDidStop:finished:] + 576 (UIView.m:2238)
30  QuartzCore                      0x00000001bd2dbdac CA::Layer::run_animation_callbacks(void*) + 276 (CALayer.mm:6832)
31  libdispatch.dylib               0x00000001b6513184 _dispatch_client_callout + 16 (object.m:495)
32  libdispatch.dylib               0x00000001b64f634c _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 996 (inline_internal.h:2484)
33  CoreFoundation                  0x00000001b67c45e4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1749)
34  CoreFoundation                  0x00000001b67bf5d8 __CFRunLoopRun + 2004 (CFRunLoop.c:3069)
35  CoreFoundation                  0x00000001b67beadc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
36  GraphicsServices                0x00000001c075f328 GSEventRunModal + 104 (GSEvent.c:2246)
37  UIKitCore                       0x00000001ba8cc63c UIApplicationMain + 1936 (UIApplication.m:4773)
38  ARMail                          0x0000000100ffec90 main + 68 (ViewController.swift:13)
39  libdyld.dylib                   0x00000001b6648360 start + 4

Due to space restrictions, I only provided related crash info.

This log is given to me and I am able to double-click it and insert it into XCode. From there, I am able to see the exact location of the error. However, in this case, I am having an issue determining the exact problem. Notice on thread 0 we can see that the last error occurs at 3 DepthCamera 0x00000001017e911c AVCaptureDevice.selectDepthFormat() + 3488 (AVCaptureDevice+Extension.swift:0)

selectDepthFormat() is an extension for class type AVCaptureDevice. Additionally, from Apple Docs, we know that an assertionFailure() stems from a nil value that could be optional. Now, I know how to accomplish this and am not concerned with best programming practices. I want to know how to determine the exact location within the method .selectDepthDFormat() and why the error only shows the error of the method called, not the exact problem of the method.

For instance, when I insert the crashlog.crash into XCode, I receive enter image description here

when I feel I should be receiving an error within the method somewhere inside of here

enter image description here

Note: I provided the code as an image to indicate where the error from the crash log shows the error and that the error seems like it should be within the method not at the beginning of the call.


Solution

  • The crash is due to one of fatalError

    This

    demo1

    or this

    demo2

    Absence of available/supported formats is normal situation and you have to handle it gracefully for end-user, showing some feedback, like alert, icon, etc. But not crash.

    Actually, I would not recommend to leave fatalError() in deployment builds at all - it is useless and only makes users unhappy - nobody likes crashing applications.