React-native-firebase: 馃敟 Crashlytics is not showing crash for ios

Created on 2 Sep 2019  路  13Comments  路  Source: invertase/react-native-firebase

Issue

Hello all.
I am having an issue with Crashlytics on IOS.
I've setup the library in a project and, while testing out crashlytic, I am having an issue only with ios.
For simulating a crash, I am using crashlytics().crash();. The app crashes fine for both platforms, but on firebase console only the android crash is shown.

While testing ios crash, I've sniffed the network with Charles and can see that the following request is made:

image

The response is 202 Accepted, but I can't see the crash in the console.

I used the following steps to setup the library: https://rnfirebase.io/docs/v5.x.x/crashlytics/ios


Project Files






iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

platform :ios, '9.0'

# The target name is most likely the name of your project.
target 'app' do

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # Needed for debugging
    'RCTAnimation', # Needed for FlatList and animations running on native UI thread
    'RCTImage', # Needed for svg icons
    # Add any other subspecs you want to use in your project
  ]

  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # Required by RNFirebase
  pod 'Firebase/Core', '~> 5.20.1'
  pod 'Firebase/Analytics'

  pod 'Fabric', '~> 1.9.0'
  pod 'Crashlytics', '~> 3.12.0'

  pod 'GoogleIDFASupport', '~> 3.14.0'

  # Firebase GTM
  pod 'GoogleTagManager'

  # Reanimated
  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

  # svg icons
  pod 'RNSVG', :path => '../node_modules/react-native-svg'

  # Braze RN integration
  pod 'react-native-appboy-sdk', :path => '../node_modules/react-native-appboy-sdk'

  pod 'SentryReactNative', :path => '../node_modules/react-native-sentry'

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

#### `AppDelegate.m`:
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <Firebase.h>
#import <AppboyKit.h>

#import <ReactNativeConfig/ReactNativeConfig.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"app"
                                            initialProperties:nil];

  NSString *brazeKey = [ReactNativeConfig envFor:@"BRAZE_IOS_KEY"];

  [Appboy startWithApiKey:brazeKey
            inApplication:application
        withLaunchOptions:launchOptions];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
    center.delegate = self;
    UNAuthorizationOptions options = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
    if (@available(iOS 12.0, *)) {
      options = options | UNAuthorizationOptionProvisional;
    }
    [center requestAuthorizationWithOptions:options
                          completionHandler:^(BOOL granted, NSError * _Nullable error) {
                            [[Appboy sharedInstance] pushAuthorizationFromUserNotificationCenter:granted];
                          }];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
  } else {
    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound) categories:nil];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
  }

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  [[Appboy sharedInstance] registerPushToken:[NSString stringWithFormat:@"%@", deviceToken]];
}

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
  [[Appboy sharedInstance] registerApplication:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
  [[Appboy sharedInstance] userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
  [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"src/index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end


Android

Click To Expand

Works perfectly


Environment

Click To Expand

**`react-native info` output:**

  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
      Memory: 1.60 GB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 28
        Build Tools: 28.0.3
        System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5692245
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react-native: 0.59.8 => 0.59.8
    npmGlobalPackages:
      react-native-cli: 2.0.1
- **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `^5.3.1` - **`Firebase` module(s) you're using that has the issue:** - `Crashlytics` - **Are you using `TypeScript`?** - `N`


Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

Most helpful comment

That is a great summary of the reasons you might not see a dSYM @ycai2 - just wanted to mention that I wrote up something on why the dSYMs may not get uploaded, plus how to automate the uploading in an answer here: https://stackoverflow.com/a/55796619/9910298 (and the summary would be: 'in a bitcode-enabled world, uploading dSYMs from your build process no longer works')

All 13 comments

How long have you been waiting? Crash reports can take a good while to come though from experience.

@Ehesp A couple of days. I even waited over a weekend

2 quick thoughts in addition to "patience"

  • why not updated to 5.5.6 + most recent pods, no reason not to be on current and maybe they've fixed a bug, the firebase ios sdk release notes are frequently interesting, as our the react-native-firebase ones... works with react-native 0.59 or react-native 0.60 (with one patch from v5.x.x branch #2445 )
  • are you sure you've uploaded your dSYMs correctly. It's not so easy to get right in these bitcode-enabled days: https://stackoverflow.com/a/55796619/9910298

@mikehardy , thanks for you response.

I've updated the version to the most recent ones, but it didn't solve the problem.
Regarding the dSYMs, I did the manual step you mentioned in order to make sure it works. It might have worked, as I can see that the number o crash free users have changed, but for some reason I still can't see anything on the "Event Trends" or on the "Issues" dashboards.
image

Do you know if it means that it is working now?

Thank you

Seeing that it recognized a crash seems like a positive step but I'm not sure past that, sorry

Ok, thank you anyway

I'm having the same issue with my project. Will update here if I find anything. But I'm using RNFB 6.x, which idk if is expected to be functioning properly.

Also facing this issue...

@viniciusffj I got mine fixed. For me, it was because my dSYM wasn't automatically uploaded correctly, so I had to manually upload it on the console. There could really be various reasons that can cause the dashboard to show a state like this: it could be that your crashed users haven't relaunched the app yet so they can't report it, or it could be that the "required" dSYM isn't there or isn't uploaded properly, or it could be something else that I didn't run into.
In my case, on the dSYM page, there was a label saying "required", even though I had setup the automatic dSYM upload properly on Xcode. Therefore, I had to go to the AppStore Connect portal, go to the Activity tab, and find the dSYM download link for my specific build. That helped me with my dashboard.

That is a great summary of the reasons you might not see a dSYM @ycai2 - just wanted to mention that I wrote up something on why the dSYMs may not get uploaded, plus how to automate the uploading in an answer here: https://stackoverflow.com/a/55796619/9910298 (and the summary would be: 'in a bitcode-enabled world, uploading dSYMs from your build process no longer works')

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

Uploading manually dSYM file on crashlytics fixed my problem

Was this page helpful?
0 / 5 - 0 ratings