Firebase crashlytics不会告诉我swift的确切崩溃问题

问题描述 投票:0回答:1

我已经在堆栈上阅读了很多与此有关的问题,但是有什么解决方案可以解决此问题,以使崩溃报告中缺少部分?

enter image description here

我知道这些崩溃是由于零或未包装的选项或其他原因引起的,但是objc的崩溃要好得多:

enter image description here

我的项目基于objetive-c(几年前开始),但是新的主要部分很快就写了。来自objc部分的所有崩溃都得到了详尽的描述,但是来自swift部分的崩溃则没有。

所以问题是,我将如何获取可读的崩溃报告,而不是EXC_BREAKPOINT 0x00000001028817ac

ios swift firebase crashlytics
1个回答
0
投票

对于这种情况,我建议在应用程序中添加用户行为的高级分析,然后尝试与用户重复相同的步骤。这将有助于找到此类崩溃的根源。我可以共享代码,您可以在这些代码的基础上在应用程序的屏幕上添加必要的功能:

import Foundation
import Crashlytics

class EventLogger {

    /// Log a handled non-fatal exception
    class func logException(_ exception: NSException) {
        print("Catched exception: \(exception.debugDescription)")

        let frames = exception.callStackSymbols.map { symbol in CLSStackFrame(symbol: symbol) }
        Crashlytics.sharedInstance().recordCustomExceptionName(exception.name.rawValue, reason: exception.reason, frameArray: frames)
    }

    private class func log(_ string: String) {
        CLSLogv(string, getVaList([]))
    }

    class func log(screen: String) {
        log("User is located at \(screen) Screen")
    }

    /// Log a status of feature
    class func log(feature: String, status: String) {
        log("Feature \(feature) was \(status)")
    }

    /// Log an event
    class func log(event: String) {
        log("Event: \(event)")
    }
}

并像这里一样插入:

EventLogger.log(event: "Pressed login button")

崩溃后,您可以确切看到此崩溃的操作日志

© www.soinside.com 2019 - 2024. All rights reserved.