[英]Swift :- How to do the customize report for Crashlytics in Swift
I'm new to the Crashlytics
and I have just started using it after Google bought them (aka FirebaseCrashlytics SDK without Fabric).我是
Crashlytics
,在 Google 购买后我才开始使用它(又名 FirebaseCrashlytics SDK,没有 Fabric)。 I have tried the documents and emailing Firebase on how to do the customize report, but didn't get an answer I was looking for.我已经尝试了有关如何制作自定义报告的文档和通过电子邮件发送 Firebase,但没有得到我想要的答案。 Also, the document
Crashlytics.sharedInstance()
don't have shareInstance popup when I type Crashlytics.此外,当我键入 Crashlytics 时,文档
Crashlytics.sharedInstance()
没有 shareInstance 弹出窗口。 Here is one of the crashes I have and I would like to use the custom log to help me find out more about the crashes.这是我遇到的崩溃之一,我想使用自定义日志来帮助我了解有关崩溃的更多信息。
var sectionHeaderForSelectedDate: [ChartData] = [] //Section Headder
var cellInSectionForSelectedDate: [[ChartData]] = [] //Cell in section
override func viewDidLoad() {
super.viewDidLoad()
setupScreen()
}
func setupScreen() {
if sectionHeaderForSelectedDate[0].value[0].date.convertDateToString(dateFormat: .dayOfWeekMonthDayYear) != "" {
self.title = "\(sectionHeaderForSelectedDate[0].value[0].date.convertDateToString(dateFormat: .dayOfWeekMonthDayYear)) Sums"
}
tableView.delegate = self
tableView.dataSource = self
for (index, metricItem) in sectionHeaderForSelectedDate.enumerated() {
tableViewData.append(cellData(opended: false, title: metricItem.name,
sectionData: cellInSectionForSelectedDate[index]))
}
tableView.reloadData()
}
According to me, the crash has happened in the setupScreen()
and I would like to have a log to actually tell me if my segue
from another viewcontroller
is passing value to my variable ( sectionHeaderForSelectedDate
and cellInSectionForSelectedDate
).据我,坠机发生在
setupScreen()
我想有一个日志实际上告诉我,如果我segue
从另一个viewcontroller
被传递价值,以我的变量( sectionHeaderForSelectedDate
和cellInSectionForSelectedDate
)。 How do I do it and where should I put the code in the function?我该怎么做,我应该将代码放在函数中的什么位置?
Thank you and please correct me if any of my comments about Crashlytics is incorrect.谢谢,如果我对 Crashlytics 的任何评论不正确,请纠正我。
I didn't know Crashlytics has the beta version for the crash report with the correct syntax.我不知道 Crashlytics 有使用正确语法的崩溃报告测试版。 I found it and tested it out it is working now!
我找到了它并测试了它现在可以工作了! I used the debug example codes from Firebase to tested the report.
我使用 Firebase 的调试示例代码来测试报告。 Please check out the codes and the screenshots.
请查看代码和屏幕截图。
FirebaseCrashlytics Customize Crash Report FirebaseCrashlytics 自定义崩溃报告
override func viewDidLoad() {
super.viewDidLoad()
documentPicker.delegate = self
documentPicker.allowsMultipleSelection = false
if isFromChatBot == true {
showIntakeOptions()
}
let button = UIButton(type: .roundedRect)
button.frame = CGRect(x: 20, y: 50, width: 100, height: 30)
button.setTitle("Crash", for: [])
button.addTarget(self, action: #selector(self.crashButtonTapped(_:)), for: .touchUpInside)
view.addSubview(button)
Crashlytics.crashlytics().setCustomValue("\(isFromChatBot)", forKey: "viewdeloadTest")
Crashlytics.crashlytics().log("viewdeloadTestForCrash")
}
@IBAction func crashButtonTapped(_ sender: AnyObject) {
Crashlytics.crashlytics().setCustomValue("test", forKey: "test1")
Crashlytics.crashlytics().log("crashbuttonTapped")
//Analytics.logEvent("Setup screen", parameters: nil)
fatalError()
}
That's when you will need the good FirebaseAnalytics
.那时您将需要良好的
FirebaseAnalytics
。
You can send logs in each of your necessary events, like so:您可以在每个必要的事件中发送日志,如下所示:
Analytics.logEvent("Setup screen", parameters: nil)
Make use of the eventName
, and parameters
.使用
eventName
和parameters
。
After this, when the crash happens and you have a logged event before that, you will see this information in your LOGS tab.在此之后,当崩溃发生并且在此之前您有记录的事件时,您将在LOGS选项卡中看到此信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.