How to use Sentry for Multiple iOS Targets in React-Native
OS:
- [ ] Windows
- [x] MacOS
- [ ] Linux
Platform:
- [x] iOS
- [ ] Android
SDK:
- [x]
@sentry/react-native(>= 1.0.0) - [ ]
react-native-sentry(<= 0.43.2)
SDK version: 5.14.1
react-native version: 0.70.6
Are you using Expo?
- [ ] Yes
- [x] No
Are you using sentry.io or on-premise?
- [x] sentry.io (SaaS)
- [ ] on-premise
If you are using sentry.io, please post a link to your issue so we can take a look:
Configuration:
(@sentry/react-native)
Sentry.init({
dsn: 'https://[email protected]/...'
});
We have multiple targets in iOS in our React Native app. When I ran the sentry wizard it updated the Bundle React Native code and images section and added a new Run Script under Build Phases for Upload Debug Symbols to Sentry only for the first target.
If I created a Release build for other flavors they wouldn't show stack trace with readable code. It would be only minified.
I had to update /bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\"" under Bundle React Native code and images section for each target.
And I also had to create a new Run Script under Build Phases for Upload Debug Symbols to Sentry only for each target with /bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh
After I did this I could see the stack trace with readable code. Am I missing something?
So every time I add a new target will I have to do this manually? Please guide me if there is a way to automate this for all the targets.
Hi @jitenshah19,
you have not missed anything, the current @sentry/wizard only setups up Sentry for one target.
Thank you for mentioning this, I'll move the issue to the Wizard repository as an feature request to support multiple targets setup.
I'm happy to hear that after adding the steps manually you got the symbolicated errors.
For anyone reading this later, this docs page describes what to add for the auto source maps upload.
https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/