'Crashlytics not working in ios and given log as crashlytics collection is not enabled, not crashing

React native project when debugging crashlytics not working

Logs given as below 2022-04-20 16:59:18.685 Db Wapp Staging[76015:1fff68] [com.apple.defaults:User Defaults] found no value for key crashlytics_debug_enabled in CFPrefsSearchListSource<0x600001682f00> (Domain: io.invertase.firebase, Container: (null)) 2022-04-20 16:59:18.685 Df Wapp Staging[76015:1fff68] +[RNFBSharedUtils getConfigBooleanValue:key:defaultValue:] [Line 157] RNFBCrashlyticsInit crashlytics_debug_enabled via RNFBMeta: 0 2022-04-20 16:59:18.686 Df Wapp Staging[76015:1fff68] +[RNFBSharedUtils getConfigBooleanValue:key:defaultValue:] [Line 160] RNFBCrashlyticsInit crashlytics_debug_enabled final value: 0 2022-04-20 16:59:18.686 Df Wapp Staging[76015:1fff68] +[RNFBCrashlyticsInitProvider isCrashlyticsCollectionEnabled] [Line 49] RNFBCrashlyticsInit isCrashlyticsCollectionEnabled after checking crashlytics_debug_enabled: 0 2022-04-20 16:59:18.687 I Wapp Staging[76015:1fff68] [com.facebook.react.log:native] Crashlytics - INFO: crashlytics collection is not enabled, not crashing.



Solution 1:[1]

Just crash your app once by adding this line --->> crashlytics().crash(); in your startup screen and then just remove this line. It will start working.

Solution 2:[2]

TL;DR THIS IS NOT AN ANSWER, JUST A SIMILAR SITUATION

Getting a similar log and the app doesn't crash whatsoever. What OP and I are trying to do I guess is to check if @react-native-firebase/crashlytics is working properly on iOS according to this blog post (taken from official documentation). Some background info:

// Example JS code
import React from "react"
import { Button } from "react-native"
import crashlytics from "@react-native-firebase/crashlytics"

export const App = () => <Button title="Pls crash" onPress={() => { crashlytics().crash() } />

firebase.json configuration file:

{
  "react-native": {
    "android_task_executor_maximum_pool_size": 10,
    "android_task_executor_keep_alive_seconds": 3,
    "crashlytics_debug_enabled": true,
    "crashlytics_disable_auto_disabler": true,
    "crashlytics_auto_collection_enabled": true,
    "crashlytics_is_error_generation_on_js_crash_enabled": true,
    "crashlytics_javascript_exception_handler_chaining_enabled": true
  }
}

Package versions used:

"dependencies": {
    "@react-native-firebase/analytics": "^14.8.0",
    "@react-native-firebase/app": "^14.8.0",
    "@react-native-firebase/crashlytics": "^14.8.0",
    "@react-native-firebase/messaging": "^14.8.0",
    ...
    "react-native": "0.63.4",
}

Error log, while using xcrun simctl spawn booted log stream --level debug --style compact | grep -i crash (after button press):

2022-04-25 14:37:36.600 Db MyApp[58368:86594] [com.apple.defaults:User Defaults] CFPrefsPlistSource<0x600003c06e00> (Domain: io.invertase.firebase, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No) skipping setting already-present value for key crashlytics_auto_collection_enabled
2022-04-25 14:37:39.101 Db MyApp[58368:86594] [com.apple.defaults:User Defaults] found no value for key crashlytics_debug_enabled in CFPrefsSearchListSource<0x600003c06d80> (Domain: io.invertase.firebase, Container: (null))
2022-04-25 14:37:39.101 Df MyApp[58368:86594] +[RNFBSharedUtils getConfigBooleanValue:key:defaultValue:] [Line 157] RNFBCrashlyticsInit crashlytics_debug_enabled via RNFBMeta: 0
2022-04-25 14:37:39.101 Df MyApp[58368:86594] +[RNFBSharedUtils getConfigBooleanValue:key:defaultValue:] [Line 160] RNFBCrashlyticsInit crashlytics_debug_enabled final value: 0
2022-04-25 14:37:39.101 Df MyApp[58368:86594] +[RNFBCrashlyticsInitProvider isCrashlyticsCollectionEnabled] [Line 49] RNFBCrashlyticsInit isCrashlyticsCollectionEnabled after checking crashlytics_debug_enabled: 0
2022-04-25 14:37:39.101 I  MyApp[58368:86594] [com.facebook.react.log:native] Crashlytics - INFO: crashlytics collection is not enabled, not crashing.

Expected behaviour: in theory the app should crash and I should see a log in firebase crashlytics console.

Result: nothing happens, like seriously - nothing.

Environment: debug/development, the release version seems to be working fine.

Edit: added expected, result and environment.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abhijeet Singh
Solution 2