Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa guida rapida descrive come configurare Firebase Crashlytics nella tua app
con l'SDK Firebase Crashlytics in modo da poter ottenere report sugli arresti anomali completi
nella console Firebase.
La configurazione di Crashlytics richiede attività sia nella console Firebase sia
nel tuo IDE (come l'aggiunta di un file di configurazione Firebase e dell'SDK Crashlytics). Per completare la configurazione, devi forzare un arresto anomalo di test per inviare il primo
report sugli arresti anomali a Firebase.
Prima di iniziare
Se non l'hai ancora fatto, aggiungi Firebase al tuo progetto Apple. Se non hai un'app Apple, puoi scaricare un'app di esempio.
Consigliato: per ottenere automaticamente i log dei breadcrumb per comprendere le azioni dell'utente che hanno portato a un evento di arresto anomalo, non irreversibile o ANR, devi attivare Google Analytics nel tuo progetto Firebase.
Se il tuo progetto Firebase esistente non ha Google Analytics
abilitato, puoi abilitare Google Analytics dalla
scheda Integrazioni di
settings > Impostazioni progetto
nella console Firebase.
Se crei un nuovo progetto Firebase, abilita Google Analytics
durante il flusso di lavoro di creazione del progetto.
Passaggio 1: aggiungi l'SDK Crashlytics alla tua app
Utilizza Swift Package Manager per installare e gestire le dipendenze di Firebase.
In Xcode, con il progetto dell'app aperto, vai a File > Add Packages (File > Aggiungi pacchetti).
Quando richiesto, aggiungi il repository dell'SDK delle piattaforme Apple di Firebase:
Aggiungi il flag -ObjC alla sezione Altri flag del linker delle impostazioni di build del target.
(Solo macOS) In Info.plist, aggiungi la chiave
NSApplicationCrashOnExceptions e impostala su
YES.
Al termine, Xcode inizierà automaticamente a risolvere e a scaricare le tue dipendenze in background.
A questo punto, configura il modulo Firebase:
Importa il modulo Firebase nella struttura App o in UIApplicationDelegate:
Swift
importFirebase
Objective-C
@importFirebase;
Configura un'istanza condivisa FirebaseApp, in genere nel metodo application(_:didFinishLaunchingWithOptions:) del delegato dell'app:
Swift
// Use the Firebase library to configure APIs.FirebaseApp.configure()
Objective-C
// Use the Firebase library to configure APIs.[FIRAppconfigure];
Passaggio 3: forza un arresto anomalo del test per completare la configurazione
Per completare la configurazione di Crashlytics e visualizzare i dati iniziali nella dashboard
Crashlytics della console Firebase, devi forzare un arresto anomalo
di test.
E questo è tutto. Crashlytics ora monitora la tua app per rilevare eventuali arresti anomali.
Visita la dashboard Crashlytics per visualizzare e analizzare
tutti i tuoi report e le tue statistiche.
Esegui l'integrazione con Google Play per poter filtrare i report sugli arresti anomali della tua app per Android in base alla traccia Google Play direttamente nella dashboard Crashlytics. In questo modo puoi concentrare meglio la dashboard su build specifiche.
[null,null,["Ultimo aggiornamento 2025-08-12 UTC."],[],[],null,["\u003cbr /\u003e\n\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\niOS+ Android Android (NDK) Flutter Unity \n\n\u003cbr /\u003e\n\nThis quickstart describes how to set up Firebase Crashlytics in your app\nwith the Firebase Crashlytics SDK so that you can get comprehensive crash\nreports in the Firebase console.\n\nSetting up Crashlytics requires tasks both in the Firebase console and\nyour IDE (like adding a Firebase configuration file and the Crashlytics\nSDK). To finish setup, you'll need to force a test crash to send your first\ncrash report to Firebase.\n\nBefore you begin\n\n1. If you haven't already, [add Firebase](/docs/ios/setup) to your Apple\n project. If you don't have an Apple app, you can download a\n [sample app](/docs/samples).\n\n2. **Recommended** : To automatically get\n [breadcrumb logs](/docs/crashlytics/customize-crash-reports#get-breadcrumb-logs)\n to understand user actions leading up to a crash, non-fatal, or ANR event,\n you need to enable Google Analytics in your Firebase project.\n\n - If your existing Firebase project doesn't have Google Analytics\n enabled, you can enable Google Analytics from the\n [**Integrations** tab](https://console.firebase.google.com/project/_/settings/integrations/analytics) of your\n settings \\\u003e *Project settings*\n in the Firebase console.\n\n - If you're creating a new Firebase project, enable Google Analytics\n during the project creation workflow.\n\n \u003cbr /\u003e\n\n**Step 1** : Add the Crashlytics SDK to your app\n\nUse Swift Package Manager to install and manage Firebase dependencies.\n| Visit [our installation guide](/docs/ios/installation-methods) to learn about the different ways you can add Firebase SDKs to your Apple project, including importing frameworks directly and using CocoaPods.\n\n1. In Xcode, with your app project open, navigate to **File \\\u003e Add Packages**.\n2. When prompted, add the Firebase Apple platforms SDK repository: \n\n```text\n https://github.com/firebase/firebase-ios-sdk.git\n```\n| **Note:** New projects should use the default (latest) SDK version, but you can choose an older version if needed.\n3. Choose the Crashlytics library.\n4. To take advantage of [breadcrumb logs](/docs/crashlytics/customize-crash-reports#get-breadcrumb-logs), also add the Firebase SDK for Google Analytics to your app. Make sure that [Google Analytics is enabled](https://support.google.com/firebase/answer/9289399#linkga) in your Firebase project.\n5. Add the `-ObjC` flag to the *Other Linker Flags* section of your target's build settings.\n6. *(macOS only)* In your `Info.plist`, add the key `NSApplicationCrashOnExceptions` and set it to `YES`.\n7. When finished, Xcode will automatically begin resolving and downloading your dependencies in the background.\n\nNext, configure the Firebase module:\n\n1. Import the Firebase module in your `App` struct or `UIApplicationDelegate`:\n\n Swift \n\n ```swift\n import Firebase\n ```\n\n Objective-C \n\n ```objective-c\n @import Firebase;\n ```\n2. Configure a `FirebaseApp` shared instance, typically in your app delegate's\n `application(_:didFinishLaunchingWithOptions:)` method:\n\n Swift \n\n ```swift\n // Use the Firebase library to configure APIs.\n FirebaseApp.configure()\n ```\n\n Objective-C \n\n ```objective-c\n // Use the Firebase library to configure APIs.\n [FIRApp configure];\n ```\n\n**Step 3**: Force a test crash to finish setup\n\nTo finish setting up Crashlytics and see initial data in the\nCrashlytics dashboard of the Firebase console, you need to force a test\ncrash.\n\n\u003cbr /\u003e\n\nAnd that's it! Crashlytics is now monitoring your app for crashes.\nVisit the [Crashlytics dashboard](https://console.firebase.google.com/project/_/crashlytics) to view and investigate\nall your reports and statistics.\n\nNext steps\n\n- [Customize your crash report setup](/docs/crashlytics/customize-crash-reports) by adding opt-in reporting, logs, keys, and tracking of non-fatal errors.\n\n\u003c!-- --\u003e\n\n- [Integrate with Google Play](/docs/crashlytics/integrate-with-google-play) so that you can filter your Android app's crash reports by Google Play track directly in the Crashlytics dashboard. This allows you to better focus your dashboard on specific builds."]]