破解iOS崩溃日志。程序在layoutIfNeeded

时间:2018-07-23 07:50:38

标签: ios swift xcode crash crash-reports

我从App Store获得了我的应用程序的崩溃日志。我无法重现崩溃并很难解读它。 以下是日志-

Incident Identifier: AEF0FFDD-77E4-460F-97E4-B97A32EAE36D
CrashReporter Key:   78177aeeda1175c67f4467d02c023a2a165d1a01
Hardware Model:      iPhone7,1
Process:             Visits [4558]
Path:                /private/var/containers/Bundle/Application/81AC75BC-433C-43E7-887D-8FC6BF5B5703/Visits.app/Visits
Identifier:          com.x.y
Version:             1.1.1 (1.1.1)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.x.y [1143]


Date/Time:           2018-07-20 22:30:36.6608 +0530
Launch Time:         2018-07-20 22:30:35.9017 +0530
OS Version:          iPhone OS 11.4.1 (15G77)
Baseband Version:    6.80.00
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x184136d8c __exceptionPreprocess + 228 (NSException.m:166)
1   libobjc.A.dylib                 0x1832f05ec objc_exception_throw + 56 (objc-exception.mm:521)
2   CoreFoundation                  0x1840cfd80 -[__NSSingleObjectArrayI objectAtIndex:] + 128 (NSSingleObjectArray.m:16)
3   UIKit                           0x18e6b0aa8 -[UITableViewDataSource tableView:cellForRowAtIndexPath:] + 172 (UITableViewDataSource.m:170)
4   UIKit                           0x18e3c90f4 -[UITableViewController tableView:cellForRowAtIndexPath:] + 68 (UITableViewController.m:441)
5   UIKit                           0x18de130cc -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668 (UITableView.m:13463)
6   UIKit                           0x18de12d84 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80 (UITableView.m:13514)
7   UIKit                           0x18de11aa0 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2280 (UITableView.m:2599)
8   UIKit                           0x18de0d5ec -[UITableView layoutSubviews] + 140 (UITableView.m:8565)
9   UIKit                           0x18dd4a6f4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420 (UIView.m:15239)
10  QuartzCore                      0x1882bfe54 -[CALayer layoutSublayers] + 184 (CALayer.mm:9357)
11  QuartzCore                      0x1882c3fe4 CA::Layer::layout_if_needed(CA::Transaction*) + 324 (CALayer.mm:9237)
12  UIKit                           0x18dd62bf4 -[UIView(Hierarchy) layoutBelowIfNeeded] + 548 (UIView.m:10438)
13  Visits                          0x1007a8300 MainViewController.initialSetupForScreen() + 804 (MainViewController.swift:217)
14  Visits                          0x1007a7ea4 MainViewController.viewDidLoad() + 924 (MainViewController.swift:175)
15  Visits                          0x1007a8838 @objc MainViewController.viewDidLoad() + 28
16  UIKit                           0x18dd51e64 -[UIViewController loadViewIfRequired] + 1020 (UIViewController.m:3192)
17  UIKit                           0x18dd51a50 -[UIViewController view] + 28 (UIViewController.m:3214)
18  UIKit                           0x18dd42ce4 -[UIWindow addRootViewControllerViewIfPossible] + 136 (UIWindow.m:1358)
19  UIKit                           0x18dd41b18 -[UIWindow _setHidden:forced:] + 272 (UIWindow.m:1455)
20  UIKit                           0x18ddcf62c -[UIWindow makeKeyAndVisible] + 48 (UIWindow.m:4883)
21  UIKit                           0x18dd45274 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3660 (UIApplication.m:2210)
22  UIKit                           0x18dd125e0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1680 (UIApplication.m:3491)
23  UIKit                           0x18e342b1c __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 784 (_UICanvasLifecycleMonitor.m:175)
24  UIKit                           0x18dd11dd0 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160 (_UICanvas.m:591)
25  UIKit                           0x18dd11c6c -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 240 (_UICanvasLifecycleMonitor.m:153)
26  UIKit                           0x18dd10afc -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 724 (_UICanvasLifecycleMonitor.m:229)
27  UIKit                           0x18e9a684c __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 296 (_UIApplicationCanvas.m:0)
28  UIKit                           0x18dd101ec -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 432 (_UIApplicationCanvas.m:156)
29  UIKit                           0x18e78bac8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220 (_UICanvasLifecycleSettingsDiffAction.m:211)
30  UIKit                           0x18e8d9bf8 _performActionsWithDelayForTransitionContext + 112 (_UICanvasSettingsDiffAction.m:34)
31  UIKit                           0x18dd0fc0c -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 248 (_UICanvasLifecycleSettingsDiffAction.m:182)
32  UIKit                           0x18dd0f5a8 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 368 (_UICanvas.m:517)
33  UIKit                           0x18dd0c5e0 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540 (UIApplication.m:3109)
34  UIKit                           0x18dd0c330 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364 (UIApplicationSceneClientAgent.m:41)
35  FrontBoardServices              0x186938470 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 364 (FBSSceneImpl.m:460)
36  FrontBoardServices              0x186940d6c __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 224 (FBSWorkspace.m:606)
37  libdispatch.dylib               0x183a28a60 _dispatch_client_callout + 16 (object.m:507)
38  libdispatch.dylib               0x183a30170 _dispatch_block_invoke_direct$VARIANT$mp + 224 (queue.c:3018)
39  FrontBoardServices              0x18696c878 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 (FBSSerialQueue.m:164)
40  FrontBoardServices              0x18696c51c -[FBSSerialQueue _performNext] + 404 (FBSSerialQueue.m:196)
41  FrontBoardServices              0x18696cab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 (FBSSerialQueue.m:232)
42  CoreFoundation                  0x1840df404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1982)
43  CoreFoundation                  0x1840dec2c __CFRunLoopDoSources0 + 276 (CFRunLoop.c:2017)
44  CoreFoundation                  0x1840dc79c __CFRunLoopRun + 1204 (CFRunLoop.c:2920)
45  CoreFoundation                  0x183ffcda8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
46  GraphicsServices                0x185fe2020 GSEventRunModal + 100 (GSEvent.c:2245)
47  UIKit                           0x18e01c758 UIApplicationMain + 236 (UIApplication.m:3965)
48  Visits                          0x1007a589c main + 56 (Location+CoreDataClass.swift:15)
49  libdyld.dylib                   0x183a8dfc0 start + 4

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000183bbd2e0 __pthread_kill + 8
1   libsystem_pthread.dylib         0x0000000183d5e288 pthread_kill$VARIANT$mp + 376 (pthread.c:1484)
2   libsystem_c.dylib               0x0000000183b2bd0c abort + 140 (abort.c:91)
3   libc++abi.dylib                 0x00000001832c72c8 abort_message + 132 (abort_message.cpp:75)
4   libc++abi.dylib                 0x00000001832c7470 default_terminate_handler() + 304 (cxa_default_handlers.cpp:68)
5   libobjc.A.dylib                 0x00000001832f08d4 _objc_terminate() + 124 (objc-exception.mm:657)
6   libc++abi.dylib                 0x00000001832e137c std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:66)
7   libc++abi.dylib                 0x00000001832e1400 std::terminate() + 84 (cxa_handlers.cpp:97)
8   libdispatch.dylib               0x0000000183a28a74 _dispatch_client_callout + 36 (object.m:510)
9   libdispatch.dylib               0x0000000183a30170 _dispatch_block_invoke_direct$VARIANT$mp + 224 (queue.c:3018)
10  FrontBoardServices              0x000000018696c878 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 (FBSSerialQueue.m:164)
11  FrontBoardServices              0x000000018696c51c -[FBSSerialQueue _performNext] + 404 (FBSSerialQueue.m:196)
12  FrontBoardServices              0x000000018696cab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 (FBSSerialQueue.m:232)
13  CoreFoundation                  0x00000001840df404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1982)
14  CoreFoundation                  0x00000001840dec2c __CFRunLoopDoSources0 + 276 (CFRunLoop.c:2017)
15  CoreFoundation                  0x00000001840dc79c __CFRunLoopRun + 1204 (CFRunLoop.c:2920)
16  CoreFoundation                  0x0000000183ffcda8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
17  GraphicsServices                0x0000000185fe2020 GSEventRunModal + 100 (GSEvent.c:2245)
18  UIKit                           0x000000018e01c758 UIApplicationMain + 236 (UIApplication.m:3965)
19  Visits                          0x00000001007a589c main + 56 (Location+CoreDataClass.swift:15)
20  libdyld.dylib                   0x0000000183a8dfc0 start + 4

以下是程序崩溃的代码段。崩溃发生在self.view.layoutIfNeeded()。

func initialSetupForScreen(){
        let screenHeight = UIScreen.main.bounds.height
        let statusBarHeight = UIApplication.shared.statusBarFrame.height

        fullyOpenSheetTop = -(screenHeight - (statusBarHeight * 2))
        partiallyOpenSheetTop = -((screenHeight * 0.50) - titleBarHeight)
        closedSheetTop = -titleBarHeight
        notVisibleSheetTop = 40 //(+40 for iphone X)

        fullyOrPartiallyThreshold = (fullyOpenSheetTop + partiallyOpenSheetTop)/2
        partiallyOrClosedThreshold = (partiallyOpenSheetTop + closedSheetTop)/2

        // set primary & secondary sheet height //(+40 for iphone X) (-40 fixed for iphone X)
        primarySheetViewHeightConstraint.constant = -fullyOpenSheetTop
        secondarySheetViewHeightConstraint.constant = -fullyOpenSheetTop

        // primary sheet is set to fully open state
        primarySheetViewTopConstraint.constant = fullyOpenSheetTop
        primarySheetCurrentState = .fullyOpen

        // secondary sheet is set to not visible state
        secondarySheetViewTopConstraint.constant = notVisibleSheetTop
        secondarySheetCurrentState = .notVisible

        // settings View move it out of screen
        settingsViewTopConstraint.constant = notVisibleSheetTop

        primarySheetController.configurePrimarySheetContentView()

        self.view.layoutIfNeeded()
    }

之前,我在viewDidLoad内部调用了此函数。我认为在viewDidLoad中调用layoutIfNeeded还为时过早。因此我将函数移至viewWillAppear。但是,崩溃似乎仍在发生。我缺少/监督什么?

崩溃很少发生在设备上,我无法重现。

0 个答案:

没有答案