bugsnag / bugsnag-react-native

Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
https://docs.bugsnag.com/platforms/react-native
MIT License
370 stars 121 forks source link

Setting appVersion in configuration gives varying results on iOS #438

Closed gregersn closed 4 years ago

gregersn commented 4 years ago

Description

I am trying to set a custom "appVersion" on crash reports

Issue

With Android everything seems to work fine. On iOS I get the overridden setting on sessions, but on crash reports, I get what CFBundleShortVersionString is set to in Info.plist

Using bugsnag-react-native version 2.23.3

mattdyoung commented 4 years ago

Hi @gregersn

Thanks for the report. This appears to be a bug, although we're already reworking this area in the next major version and this should be resolved by those changes.

In the short term you would have to ensure the CFBundleShortVersionString is also set to your app version to workaround this.

gregersn commented 4 years ago

That is not really a viable option, since that would change what is presented to users in the app store. What is the time frame on the next major version?

mattdyoung commented 4 years ago

@gregersn We've had a closer look and can't see any difference between how the appVersion is derived for sessions vs error reports. So we believe this may be related to the sequence of how you're initializing Bugsnag in the Javascript and native iOS layers in relation to where / when the session or error report is sent.

Can you share how you're configuring Bugsnag and whether you're using the enhanced native integration steps described here? https://docs.bugsnag.com/platforms/react-native/react-native/enhanced-native-integration/

If using the native integration it may be necessary to configure the appVersion in the native configuration, as well as in the Javascript: https://docs.bugsnag.com/platforms/react-native/react-native/enhanced-native-integration/#further-configuration

E.g.

#import "BugsnagConfiguration.h"

BugsnagConfiguration *config = [BugsnagConfiguration new];
config.appVersion = @"1.2.3";
[BugsnagReactNative startWithConfiguration:config];
gregersn commented 4 years ago

We are using Swift here, but in Appdelegate.swift I have

let config = BugsnagConfiguration()
config.appVersion = "1.2.3"
Bugsnag.start(with: config)
mattdyoung commented 4 years ago

Are you also configuring the appVersion in the Javascript config? https://docs.bugsnag.com/platforms/react-native/react-native/configuration-options/

mattdyoung commented 4 years ago

Closing for now as we're only able to reproduce by defining the appVersion differently in the iOS vs Javascript configs.

If you're able to share a full reproduction example we'd be happy to take another look.