Skip to content

Commit f3d0cf2

Browse files
antonisclaude
andcommitted
fix(ios): Fix podspec compiler flags being overridden by install_modules_dependencies
`s.compiler_flags` was silently overridden by `install_modules_dependencies()`, so `-DSENTRY_PROFILING_SUPPORTED`, `-DNEW_HERMES_RUNTIME`, and `-DRCT_NEW_ARCH_ENABLED` were never applied. Add flags to `pod_target_xcconfig['OTHER_CFLAGS']` which takes effect correctly. Also set `REACT_NATIVE_NODE_MODULES_DIR` in the sample app's Podfile and pod-install script so the podspec detects the app's RN version instead of the SDK's devDependency version in the monorepo. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4157b02 commit f3d0cf2

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

packages/core/RNSentry.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ Pod::Spec.new do |s|
4848

4949
s.pod_target_xcconfig = {
5050
'DEFINES_MODULE' => 'YES',
51-
'HEADER_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}/Sentry/Sources/Sentry" "${PODS_ROOT}/Sentry/Sources/Sentry/include"'
51+
'HEADER_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}/Sentry/Sources/Sentry" "${PODS_ROOT}/Sentry/Sources/Sentry/include"',
52+
'OTHER_CFLAGS' => other_cflags
5253
}
5354

5455
s.dependency 'Sentry', '9.8.0'

samples/react-native/ios/Podfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ require Pod::Executable.execute_command('node', ['-p',
55
{paths: [process.argv[1]]},
66
)', __dir__]).strip
77

8+
# In the monorepo, the SDK podspec resolves react-native to its own devDependency.
9+
# Point it to the sample app's react-native so it detects the correct version for build flags.
10+
ENV['REACT_NATIVE_NODE_MODULES_DIR'] ||= File.expand_path(File.join(__dir__, '..', 'node_modules', 'react-native'))
11+
812
platform :ios, min_ios_version_supported
913
prepare_react_native_project!
1014

samples/react-native/scripts/pod-install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
1212
cd "${thisFilePath}/.."
1313
bundle install
1414

15+
# In the monorepo, the SDK's packages/core resolves react-native to its own devDependency version.
16+
# We need to point the podspec to the sample app's react-native so it detects the correct version.
17+
export REACT_NATIVE_NODE_MODULES_DIR="${PWD}/node_modules/react-native"
18+
1519
cd ios
1620
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod update
1721

0 commit comments

Comments
 (0)