了解Crashlytics故障报告(部分适用) [英] Understanding Crashlytics Crash Report (partial apply)

查看:170
本文介绍了了解Crashlytics故障报告(部分适用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

难以理解Crashlytics中的崩溃报告。我在分析崩溃报告方面经验不足。感谢您的帮助。

Having trouble understanding a crash report in Crashlytics. I do not have much experience in analyzing crash report. Appreciate your help.

这是崩溃日志:

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年内没有任何崩溃。

Update: Added the code for doneButtonPressed. I do not make any changes to this part recently. This scene do not have any crash for 1.5 years since it is released.

 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)
                            }
                        })
                    }

                }
            }
        }
    }


推荐答案

添加 [弱自我] 在闭包的完成块中解决了这个问题。

您偶然发现了一种罕见的情况,当 self 被释放并且在调用完成块之前为零时,使用 self。使应用程序崩溃。

Adding [weak self] in the closure's completion block solves this.
You just stumbled upon a rare situation when self was released and was nil before the completion block was called, making the use of self. crash the application.

这篇关于了解Crashlytics故障报告(部分适用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆