了解Crashlytics崩溃报告(部分申请)

时间:2017-11-03 10:23:45

标签: ios swift crash crashlytics

无法理解Crashlytics中的崩溃报告。我在分析崩溃报告方面没有多少经验。感谢您的帮助。

这是崩溃日志:

Crashed: com.apple.main-thread
    0  My App                    0x100f77180 specialized closure #1 in closure #1 in ConfirmItemCheckInViewController.doneButtonPressed() (ConfirmItemCheckInViewController.swift:175)
    1  My App                    0x100f77c94 partial apply for closure #1 in closure #1 in ConfirmItemCheckInViewController.doneButtonPressed() (ConfirmItemCheckInViewController.swift)
    2  My App                    0x100f95650 thunk for @callee_owned (@owned UIAlertAction) -> () (SettingsViewController.swift)
    3  UIKit                          0x18e4f5cf4 -[UIAlertController _invokeHandlersForAction:] + 108
    4  UIKit                          0x18e4f66ec __103-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:dismissCompletion:]_block_invoke.459 + 28
    5  UIKit                          0x18e33b030 -[UIPresentationController transitionDidFinish:] + 1320
    6  UIKit                          0x18e33ea20 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 188
    7  UIKit                          0x18e10a9d8 -[_UIViewControllerTransitionContext completeTransition:] + 116
    8  UIKit                          0x18e02fd7c -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 764
    9  UIKit                          0x18e02f70c -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 312
    10 UIKit                          0x18e02f418 -[UIViewAnimationState animationDidStop:finished:] + 296
    11 UIKit                          0x18e02f4b8 -[UIViewAnimationState animationDidStop:finished:] + 456
    12 QuartzCore                     0x188bd3d6c CA::Layer::run_animation_callbacks(void*) + 284
    13 libdispatch.dylib              0x18456d048 _dispatch_client_callout + 16
    14 libdispatch.dylib              0x184579b74 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1016
    15 CoreFoundation                 0x184b8ff20 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    16 CoreFoundation                 0x184b8dafc __CFRunLoopRun + 2012
    17 CoreFoundation                 0x184aae2d8 CFRunLoopRunSpecific + 436
    18 GraphicsServices               0x18693ff84 GSEventRunModal + 100
    19 UIKit                          0x18e05b880 UIApplicationMain + 208
    20 My App                    0x100f4f924 main (AppDelegate.swift:15)
    21 libdyld.dylib                  0x1845d256c start + 4

更新:添加了doneButtonPressed的代码。 我最近没有对这部分做任何改动。自发布以来,这个场景在1。5年内没有任何崩溃。

 func doneButtonPressed() {
        if let signImage = signatureImage {
            if let scheduleID = scheduleID {
                if let driverID = driverID {
                    if let customerID = customerID {
                        let progressHUD = MBProgressHUD.showAdded(to: self.view, animated: true)
                        progressHUD.label.text = "Checking Item In"
                        NetworkLoader.sharedLoader.confirmCheckIn(signImage, shipmentID: scheduleID, customerID: customerID, driverID: driverID, items: items, valueAddedItems: self.valueAddedItemsList, completion: { (networkStatus, status) in
                            progressHUD.hide(animated: true)
                            if status {
                                // Remove saved signature
                                var index = SignatureData.sharedSignatureData.getSignatureIndex(scheduleID)
                                if index != -1 {
                                    SignatureData.sharedSignatureData.sharedSignatureItems.remove(at: index)
                                }
                                // Remove saved item
                                index = PickupItemData.sharedPickupItemData.getPickupItemIndex(scheduleID)
                                if index != -1 {
                                    PickupItemData.sharedPickupItemData.sharedPickupItems.remove(at: index)
                                }

                                let alert = UIAlertController(title: "Checked In", message: "", preferredStyle: UIAlertControllerStyle.alert)
                                let alertAction: UIAlertAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: { (_) in
                                    let myScheduleNC :UINavigationController = self.storyboard?.instantiateViewController(withIdentifier: "MyScheduleNavController") as! UINavigationController
                                    self.revealViewController().pushFrontViewController(myScheduleNC, animated: true) // LINE 175 IS HERE 

                                })
                                alert.addAction(alertAction)
                                self.present(alert, animated: true, completion: nil)
                            } else {
                                print(networkStatus.networkLoaderErrorDescription)
                                let alert = UIAlertController(title: networkStatus.networkLoaderErrorTitle, message: networkStatus.networkLoaderErrorDescription, preferredStyle: UIAlertControllerStyle.alert)
                                let alertAction: UIAlertAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)
                                alert.addAction(alertAction)
                                self.present(alert, animated: true, completion: nil)
                            }
                        })
                    }

                }
            }
        }
    }

2 个答案:

答案 0 :(得分:1)

ConfirmItemCheckInViewController课程中的某些事情似乎出错了。更确切地说,此错误位于第175行的doneButtonPressed()方法中。

拥有相应的代码会很有帮助。

答案 1 :(得分:0)

在闭包的完成块中添加[weak self]可解决此问题。
您只是偶然发现了一种罕见的情况,即self被释放并且在调用完成块之前为零,从而使self.的使用使应用程序崩溃。