我已经在堆栈上阅读了很多有关此问题的问题,但是是否有任何解决方案可以修复此问题以获得崩溃报告的缺失部分?
我知道这些崩溃是由 nil 或未包装的选项或其他原因引起的,但来自 objc 的崩溃要好得多:
我的项目基于 Objective-C(几年前开始),但新的重要部分是用 Swift 编写的。来自 objc 部分的所有崩溃都很详细,但来自 swift 部分的崩溃则不然。
所以问题是,我如何获得可读的崩溃报告而不是 EXC_BREAKPOINT 0x00000001028817ac
最佳答案
对于这种情况,我建议在应用中添加用户行为的高级分析,然后尝试与用户重复相同的步骤。这将有助于找到此类崩溃的根源。我可以分享代码,您可以在此基础上在应用程序的屏幕上添加必要的功能:
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")
崩溃后,您可以准确地看到本次崩溃的操作日志
关于ios - Firebase crashlytics 没有告诉我 swift 的确切崩溃问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59490531/