由於時代不停的變遷,使得必須從Fabric Crashlytics遷移Firebase Crashlytics。
自從2017年Google收購Fabric,我之前所整合的Answers和Crashlytics就逐漸被整合到Firebase。遙想2017年我還在看Fabric後台,很有成就感地看著我開發的HiLife和Nissan。文章:Fabric Crashlytics 崩潰紀錄。
之所以不得不從Fabric Crashlytics遷移Firebase Crashlytics,是因為我每天必看的Firebase後台,出現紅色提醒:
請升級至正式發行版 Firebase Crashlytics SDK,以便在 2020 年 11 月 15 日後繼續透過 Firebase 主控台查看當機報告。瞭解詳情
https://firebase.google.com/docs/crashlytics/get-started?authuser=3
注意: Fabric SDK現在已被棄用,並將繼續報告您的應用程序崩潰,直到2020年11月15日。在這一日期,Fabric SDK和舊版本的Firebase Crashlytics SDK將停止為您的應用程序發送崩潰消息。要繼續在Firebase控制台中獲取崩潰報告,請確保您已升級到適用於Android的Firebase Crashlytics SDK版本17.0.0+ , 適用於iOS的 4.0.0+和適用於Unity的6.15.0+ 。
對於積極的開發者來說必須盡快提早部署,以免用戶還在使用舊版本App,那將無法掌握用戶狀況。
費了一番功夫,安裝龐然大物的Xcode 12,接下來專案就是透過Podfile更新第三方套件,心想不會太難才是⋯⋯
這是我最後更動的部分:
- #pod ‘Fabric’, ‘~> 1.10.2’
- #pod ‘Crashlytics’, ‘~> 3.13.4’
- #pod ‘Firebase/Core’
- #pod ‘Google/Analytics’, ‘~> 3.1.0’
- # Add the pod for Firebase Crashlytics
- pod ‘Firebase/Crashlytics’
- # Recommended: Add the Firebase pod for Google Analytics
- pod ‘Firebase/Analytics’
原本以為移除Fabric、Crashlytics,並安裝Firebase/Crashlytics、Firebase/Analytics即可,但是⋯⋯
➜git:(master) ✗ pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod “Firebase/Crashlytics":
In Podfile:
Firebase/CrashlyticsNone of your spec sources contain a spec satisfying the dependency: `Firebase/Crashlytics`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install –repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
意思是無法找到Firebase/Crashlytics相容版本,我整個黑人問號?
接著嘗試先移除Fabric、Crashlytics,成功之後,再安裝Firebase/Crashlytics、Firebase/Analytics,出現⋯⋯
➜ git:(master) ✗ pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod “FirebaseCore":
In snapshot (Podfile.lock):
FirebaseCore (= 3.6.0, ~> 3.6)In Podfile:
FirebaseCoreFirebaseCrashlytics was resolved to 4.1.1, which depends on
FirebaseCore (~> 6.6)Google/Analytics (~> 3.1.0) was resolved to 3.1.0, which depends on
Google/Core (= 3.1.0) was resolved to 3.1.0, which depends on
FirebaseAnalytics (~> 3.2) was resolved to 3.9.0, which depends on
FirebaseCore (~> 3.6)CocoaPods could not find compatible versions for pod “FirebaseCrashlytics":
In Podfile:
FirebaseCrashlyticsThere are only pre-release versions available satisfying the following requirements:
‘FirebaseCrashlytics’, ‘>= 0’
You should explicitly specify the version in order to install a pre-release version
此刻看到一堆版本號,思索代表什麼意思?想起第三方套件版本資訊會鎖在Podfile.lock,才恍然大悟,原來是版本相依出問題!仔細看發現,不同套件有用到同樣的套件(如FirebaseCore),但同樣套件卻是不同版本。
來看一下原本Podfile.lock內容:
– Crashlytics (3.13.4):
– Fabric (~> 1.10.2)
– Fabric (1.10.2)
– Firebase/Core (3.17.0):
– FirebaseAnalytics (= 3.9.0)
– FirebaseCore (= 3.6.0)
– FirebaseAnalytics (3.9.0):
– FirebaseCore (~> 3.6)
– FirebaseInstanceID (~> 1.0)
– “GoogleToolboxForMac/NSData+zlib (~> 2.1)"
– FirebaseCore (3.6.0):
– “GoogleToolboxForMac/NSData+zlib (~> 2.1)"
– FirebaseInstanceID (1.0.10):
– FirebaseCore (~> 3.6)
– Google/Analytics (3.1.0):
– Google/Core
– GoogleAnalytics (~> 3.12)
– Google/Core (3.1.0):
– FirebaseAnalytics (~> 3.2)
– GoogleAnalytics (3.17.0)
– GoogleToolboxForMac/Defines (2.2.1)
– “GoogleToolboxForMac/NSData+zlib (2.2.1)":
– GoogleToolboxForMac/Defines (= 2.2.1)
好吧⋯⋯我順便把這兩個套件移除!
- #pod ‘Firebase/Core’
- #pod ‘Google/Analytics’, ‘~> 3.1.0’
這下子就能安裝~
- # Add the pod for Firebase Crashlytics
- pod ‘Firebase/Crashlytics’
- # Recommended: Add the Firebase pod for Google Analytics
- pod ‘Firebase/Analytics’
再來看一下更新後Podfile.lock內容:
– Firebase/Analytics (6.33.0):
– Firebase/Core
– Firebase/Core (6.33.0):
– Firebase/CoreOnly
– FirebaseAnalytics (= 6.8.3)
– Firebase/CoreOnly (6.33.0):
– FirebaseCore (= 6.10.3)
– Firebase/Crashlytics (6.33.0):
– Firebase/CoreOnly
– FirebaseCrashlytics (~> 4.6.1)
– FirebaseAnalytics (6.8.3):
– FirebaseCore (~> 6.10)
– FirebaseInstallations (~> 1.6)
– GoogleAppMeasurement (= 6.8.3)
– GoogleUtilities/AppDelegateSwizzler (~> 6.7)
– GoogleUtilities/MethodSwizzler (~> 6.7)
– GoogleUtilities/Network (~> 6.7)
– “GoogleUtilities/NSData+zlib (~> 6.7)"
– nanopb (~> 1.30906.0)
– FirebaseCore (6.10.3):
– FirebaseCoreDiagnostics (~> 1.6)
– GoogleUtilities/Environment (~> 6.7)
– GoogleUtilities/Logger (~> 6.7)
– FirebaseCoreDiagnostics (1.7.0):
– GoogleDataTransport (~> 7.4)
– GoogleUtilities/Environment (~> 6.7)
– GoogleUtilities/Logger (~> 6.7)
– nanopb (~> 1.30906.0)
– FirebaseCrashlytics (4.6.1):
– FirebaseCore (~> 6.10)
– FirebaseInstallations (~> 1.6)
– GoogleDataTransport (~> 7.2)
– nanopb (~> 1.30906.0)
– PromisesObjC (~> 1.2)
– FirebaseInstallations (1.7.0):
– FirebaseCore (~> 6.10)
– GoogleUtilities/Environment (~> 6.7)
– GoogleUtilities/UserDefaults (~> 6.7)
– PromisesObjC (~> 1.2)
終於⋯⋯大公吿成?接著就下集待續XD~
其實就是要改code,API接口名稱需要更名,直到能成功編譯!
201113更新
在國父誕辰紀念日11/12發佈公司偉大新產品,終於讓後台紅色提示變成綠色訊息~居然馬上就有當機!?
參考:
Comments on: "[iOS] 從Fabric Crashlytics遷移Firebase Crashlytics" (4)
[…] 原本專案就已經有整合Firebase Crashlytics,於是就如此簡單就加入Firebase Performance,執行某行程回傳數據,約莫一天的等待後,數據真的就出現在Firebase後台,真是令人振奮! […]
讚讚
[…] 2020年Fabric和Crashlytics已被納入Firebase,還好只要透過Cocoapods更新,再稍微調整寫法,並沒有出現太大問題。 […]
讚讚
[…] 2020年Fabric和Crashlytics已被納入Firebase,還好只要Cocoapods更新,再稍微調整寫法,並沒有出現太大問題。 […]
讚讚
[…] 多虧Firebase Crashlytics的幫助,讓我曉得用戶發生哪些崩潰,在後台記錄得非常詳細,可以清楚讓我知道哪一個Class中的哪一行Code是崩潰關鍵! […]
讚讚