diff --git a/CHANGELOG.md b/CHANGELOG.md index 7776c52fa..a9d0b312f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Features + +- Add concrete error messages for RN bundle build phase patch ([#3626](https://github.com/getsentry/sentry-react-native/pull/3626)) + ### Fixes - Option `enabled: false` ensures no events are sent ([#3606](https://github.com/getsentry/sentry-react-native/pull/3606)) diff --git a/plugin/src/withSentryIOS.ts b/plugin/src/withSentryIOS.ts index 60460fc51..c33cd8d6b 100644 --- a/plugin/src/withSentryIOS.ts +++ b/plugin/src/withSentryIOS.ts @@ -46,14 +46,29 @@ export const withSentryIOS: ConfigPlugin = (config, sentryProperties: st }; export function modifyExistingXcodeBuildScript(script: BuildPhase): void { - if ( - !script.shellScript.match(/(packager|scripts)\/react-native-xcode\.sh\b/) || - script.shellScript.includes('sentry-xcode.sh') || - script.shellScript.includes('@sentry') - ) { + if (!script.shellScript.match(/(packager|scripts)\/react-native-xcode\.sh\b/)) { WarningAggregator.addWarningIOS( SDK_PACKAGE_NAME, - "Unable to modify build script 'Bundle React Native code and images'. Please open a bug report at https://github.com/expo/sentry-expo.", + `'react-native-xcode.sh' not found in 'Bundle React Native code and images'. +Please open a bug report at https://github.com/getsentry/sentry-react-native`, + ); + return; + } + + if (script.shellScript.includes('sentry-xcode.sh')) { + WarningAggregator.addWarningIOS( + SDK_PACKAGE_NAME, + "The latest 'sentry-xcode.sh' script already exists in 'Bundle React Native code and images'.", + ); + return; + } + + if (script.shellScript.includes('@sentry')) { + WarningAggregator.addWarningIOS( + SDK_PACKAGE_NAME, + `Outdated or custom Sentry script found in 'Bundle React Native code and images'. +Regenerate the native project to use the latest script. +Run npx expo prebuild --clean`, ); return; }