Migrate from Fabric Crashlytics SDK to Firebase Crashlytics SDK
Recently we migrated our crash report SDK from Fabric Crashlytics to Firebase Crashlytics.
Here’s the note:
I assume that the app has been migrated to Firebase, and you can see crashes on dashboard.
Follow the steps in the document
https://firebase.google.com/docs/crashlytics/get-started-new-sdk?platform=ios
Install new SDK
Replace
pod 'Fabric' pod 'Crashlytics'
with
pod 'Firebase/Crashlytics'
Configure for different env
Download all GoogleService-Info.plist files form your different projects and drag and drop into the Xcode project.
Remember rename them according to env or something you can recognize.
Ex: GoogleService-Info-Staging.plist, GoogleService-Info-Production.plist
Configure multiple environment in AppDelegate
#ifdef STAGING filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-Staging" ofType:@"plist"]; #elif defined PROD filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-Production" ofType:@"plist"]; #endif FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath]; [FIRApp configureWithOptions:options];
Update run script
AppStoreConfiguration="AppStore" DevReleaseConfiguration="Dev Release" StagingReleaseConfiguration="Staging Release" ProdReleaseConfiguration="Prod Release" if [ "$AppStoreConfiguration" = "${CONFIGURATION}" ]; then echo "Running Crashlytics (AppStore)" "${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/wapos-iPad/GoogleService-Info-Production.plist" echo "Uploading dSYM" find "${DWARF_DSYM_FOLDER_PATH}" -name "*.dSYM" | xargs -I \{\} "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/wapos-iPad/GoogleService-Info-Production.plist" -p ios \{\} elif [ "$ProdReleaseConfiguration" = "${CONFIGURATION}" ]; then echo "Running Crashlytics (Release)" "${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/wapos-iPad/GoogleService-Info-Production.plist" echo "Uploading dSYM" find "${DWARF_DSYM_FOLDER_PATH}" -name "*.dSYM" | xargs -I \{\} "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/wapos-iPad/GoogleService-Info-Production.plist" -p ios \{\} elif [ "$StagingReleaseConfiguration" = "${CONFIGURATION}" ]; then echo "Running Crashlytics (Staging)" "${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/wapos-iPad/GoogleService-Info-Staging.plist" echo "Uploading dSYM" find "${DWARF_DSYM_FOLDER_PATH}" -name "*.dSYM" | xargs -I \{\} "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/wapos-iPad/GoogleService-Info-Staging.plist" -p ios \{\} elif [ "$DevReleaseConfiguration" = "${CONFIGURATION}" ]; then echo "Running Crashlytics (Dev)" fi
Migrate some methods.
Last step, remove Fabric API Key setting from info.plist.
OK, that’s it.