问题
I'm forcing a crash, via a button, and Firebase/Crashlytics doesn't seem to pic it up.
Some background on my app.
My app has two App IDs, one for enterprise to be used internally and one for the app store. A script is triggered when a build is triggered, so that the right GoogleService-Info.plist is being used for the build. The enterprise version works fine, dsyms upload and crashes are received. The app store is missing the dsym and the crashes wont go through.
I make the build, stop the debugger, run the app on 4G, to cut out the company wifi which may have a firewall blocking the request
[Crashlytics] Version 3.10.5 (130)
[Fabric] [Fabric +with] called multiple times. Only the first call is honored, please pass all kits you wish to initialize
[Crashlytics:Crash:Reports] Packaged report with id '18357d12a8ce415584520b8f889d2776' for submission
[Crashlytics:Crash:Reports] Submitting report
...
[Crashlytics:Crash:Reports] completed submission of /path/to/app/file.multipartmime
[Crashlytics:Crash] report submission successful
As an aside, it said that I'm missing the dSYM, I uploaded the dsym and it still says I need to up load it.
Update:
Mike noted that the log with
[Fabric] [Fabric +with] called multiple times. Only the first call is honored, please pass all kits you wish to initialize
Looked like trouble
FirebaseApp.configure()
FirebaseConfiguration.shared.setLoggerLevel(.min)
Fabric.sharedSDK().debug = false
//Fabric.with([Crashlytics.self]) // this was causing that line to appear
So here's what the log looks like now after I plug in to the debugger after a crash.
Note: I changed the settings for the logging to .notice and for fabric debug is set to true, along with the argument FIRAnalyticsDebugEnabled to YES
[Crashlytics] Version 3.10.5 (130)
[Crashlytics:Crash:Reports] Packaged report with id 'cdece9d5d08e4caea8fcb1b1aa0e87da' for submission
[Crashlytics:Crash:Reports] Submitting report
[Crashlytics:Crash:Reports] Submitting async /path.multipartmime
[Crashlytics:Crash:Reports:Event] Sending event.
[Crashlytics:Crash] Unable to read identifier at path /path
[Crashlytics:Crash:Reports] Unable to remove a processing item
[Crashlytics:Crash:Reports] Packaged report with id '(null)' for submission
[Crashlytics:Crash:Reports] Submitting report
[Crashlytics:Crash:Reports] Submitting async path.multipartmime
4.8.1 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40009000 started
4.8.1 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see URL to some place)
[Fabric] settings downloaded successfully
[Fabric] Settings are available for consumption
[Crashlytics:Crash:Reports] completed submission of /path/770D4E72-67E0-4763-9FAA-687C0701A445.multipartmime
[Crashlytics:Crash] report submission successful
[Crashlytics:Crash:Reports] completed submission of /path.multipartmime
[Crashlytics:Crash] report submission successful
It said I didn't enable logging though I did. Weird, but no biggie.
Unfortunately still the console isn't picking up the crashes, and now that I go back to the dSYMs there were 4 entries when there were only 2 before.
Note: The crash free users stats has changed, and under the missing dSYMs it shows the crashes, but there are no issues showing up.
Here's the dSYMs
And here's the dashboard
回答1:
The things I did to fix this:
Remove Fabric keys, this only applies if you previously had Fabric/Crashlytics installed.
Remove this line
Fabric.with([Crashlytics.self])
if you see this in your console
[Fabric] [Fabric +with] called multiple times. Only the first call is honored, please pass all kits you wish to initialize
Finally if your crashes/dSYM doesn't appear add this as a run script phase in your build phases. I named the phase "Upload dSYM"
"${PODS_ROOT}/Fabric/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
I confirmed the upload was successful by going to the build log, finding "Run custom shell script 'Upload dSYM' expanding it to show the status. It should say something similar to this for the each architecture you're building for.
2018-07-19 18:38:15.630 upload-symbols[42776:1122351] Successfully submitted symbols for architecture arm64 with UUID 011bb8b8c270398292fac15e0fa117ed in dSYM: /path/YourApp.app.dSYM
回答2:
What Didn't Work
Xcode 9.4.1 | iOS 11 | Swift 4
I wasn't getting crashes despite trying a number of things that didn't work:
- Forcing a crash via
Crashlytics.sharedInstance().crash()
after initializing Crashlytics infunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
- Adding the script mentioned in another answer
"${PODS_ROOT}/Fabric/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
- Waiting 5 min between tests (a few times)
- Forcing a crash a different way, like force unwrapping a nil var.
- Running the app on a real device, both debugging through xCode and running while unplugged.
I could see this in the console...
2018-09-13 17:58:01.893028-0500 Diem[8715:8252505] [Crashlytics] Version 3.10.7 (130)
...so it seemed like Crashlytics was being initialized, but still nothing was showing up in the FB Crashlytics console.
What Fixed It
In the Firebase docs, it shows an example of creating UI, adding a crash button. I assumed adding the UI was a trivial piece, which it is. However, it seems that Crashlytics doesn't fully initialize until some point after func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
, which wasn't clear from the docs.
I moved the line that forces a crash into my main view controller's viewDidLoad()
and the crash showed up almost immediately in the Crashlytics dashboard.
回答3:
Crashlytics is having an outage, see Status here.
来源:https://stackoverflow.com/questions/51388431/crashes-not-being-received-by-firebase-crashlytics