bugsnag / bugsnag-js

JavaScript error handling tool for BugSnag. Monitor and report JavaScript bugs & errors.
https://docs.bugsnag.com/platforms/javascript
MIT License
850 stars 251 forks source link

Support iOS app extensions in react native app. #1045

Open johnkiely1 opened 3 years ago

johnkiely1 commented 3 years ago

Originally raised as PR

Description

Add dependency on Bugsnag itself if you use the core subspec

Noticed that if you use the 'Core' subspec with the Bugsnag pod included separately to bugsnag-react-native, then there's a build error, as the bugsnag-react-native files can't find the Bugsnag.h header, ie:

pod 'BugsnagReactNative', :path => '../node_modules/bugsnag-react-native/BugsnagReactNative.podspec', :subspecs => [
    'Core'
  ]
tommeier commented 3 years ago

For those playing along with https://github.com/bugsnag/bugsnag-react-native/pull/419 and now this one carried over - I've reworked the excellent hack pointed out by @crafterm to get this working with the latest version - its pretty messy now that BugsnagReactNative vendors a complete version 😬 .

Podfile:

pod 'Bugsnag' # on extensions + main RN app
pod 'BugsnagReactNative', :path => '../node_modules/@bugsnag/react-native/BugsnagReactNative.podspec', :subspecs => [
    'Core'
  ] # On main RN app

Patch:

image

As the vendored version conflicts, many warnings in Xcode 11 + 12, to avoid this the s.header_dir of the podspec needs to be removed. I'm assuming the vendored version is there to lock the version, but odd its not done with pod dependencies (i'm not sure why this isn't the case 🤔 ), so I lock the Podfile references of pod 'Bugsnag' to the same version as the vendored version in the BugsnagReactNative repo (at time of writing this looks to be 6.1.4 https://github.com/bugsnag/bugsnag-js/blob/next/packages/react-native/ios/vendor/bugsnag-cocoa/Bugsnag.podspec.json#L3)

lundn commented 3 years ago

What's the status on this? We're currently using the deprecated bugsnag-react-native library and are looking into migrating. We have both a Today and Overview extension so we have to be sure that these are working before doing the migration.