Skip to content

fix(ios-template): bundle script string escape#182

Merged
cortinico merged 1 commit into
react-native-community:mainfrom
frankcalise:frankcalise/fix-ios-template-bundle-script
Oct 17, 2025
Merged

fix(ios-template): bundle script string escape#182
cortinico merged 1 commit into
react-native-community:mainfrom
frankcalise:frankcalise/fix-ios-template-bundle-script

Conversation

@frankcalise

Copy link
Copy Markdown
Contributor

Summary:

By default, if you init an iOS project in a directory that contains spaces, it will fail in the Build Phase of Bundle React Native code and images. Removing the space from the directory, the project can successfully build. This is due to an improperly escaped string in the script found in the iOS project file.

Changelog:

[IOS] [FIXED] - iOS project will build successfully if spaces are present in the project path

Test Plan:

  1. mkdir -p ~/code/test dir
  2. npx @react-native-community/cli@latest init TestingSpaces
  3. npm run ios

Observe the build fails due to the Build Phase of Bundle React Native code and images

Modify the shell script in the build phase to:

set -e

export CONFIG_JSON=$(sed -e "s|HELLOWORLD_PATH|$(realpath "${SRCROOT}/../")|g" "${SRCROOT}/../.react-native.config")

WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"

/bin/sh -c "\"$WITH_ENVIRONMENT\" \"$REACT_NATIVE_XCODE\""

Run the iOS application again and see that it builds successfully

@cortinico cortinico merged commit f98e286 into react-native-community:main Oct 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants