我想知道如何捕获 React Native应用崩溃(处于发布模式)并将其发送到 firebase crashlytics仪表板
我找不到如何捕捉致命崩溃的信息。 但是我有一个代码示例,可以帮助我捕获非致命崩溃并将其发送到 Firebase Crashlytics 仪表板。
const sendReport = async (error,errorInfo) => {
await Promise.all([
crashlytics().setAttribute("Additional_Information", errorInfo),
]);
crashlytics().log(errorInfo);
crashlytics().recordError(error);
};
// At first i placed my code into TRY and CATCH block
try{
//some code which has error
}catch (error) {
sendReport(error,"information about place of crash")
}
//I have the example with Network requests
fetch(url)
.catch((error) => {
sendReport(error,url)
// i am sending url for know from which url i am getting the error
})
我的问题是这些
Need i use TRY{}CATCH(e){} block everywhere for tracking non-fatal crashes ??? How can i track Fatal crashes ? How can i do the dashboard crashes human-readable ? for example For Android its gives me "index.android.bundle:502:784" For iOS its gives me "index.bundle:30378:18 line 30378" Thats why i am sending additional information with crash for knowing information about place of crash
答案 0 :(得分:0)
Crashlytics应该为您做到这一点。它捕获导致应用程序崩溃的致命崩溃并进行报告(只要为该构建启用了报告)。您不必采取任何措施来捕捉致命的崩溃,比方说Crashlytics在您的应用程序周围有一个“包装器”。