Skip to content

Conversation

frankcalise
Copy link
Collaborator

@frankcalise frankcalise commented Oct 16, 2025

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

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 16, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 16, 2025
@cortinico
Copy link
Contributor

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.

The change you're sending is only for the helloworld app. The template actually lives here: https://github.com/react-native-community/template

@frankcalise
Copy link
Collaborator Author

thanks @cortinico I'll make it over there. Do you want this one to remain or it's not really important on this side?

@cortinico
Copy link
Contributor

Yeah we'd need both

@frankcalise
Copy link
Collaborator Author

Ok. I will fix the diff, it should only be a single line

@cipolleschi
Copy link
Contributor

yeah, the actual project file has been moved to the private folder. You have to sync your fork with react-native again.

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, but you need to sync your fork of React Native and apply the changes to the project located in the private folder.

@frankcalise frankcalise force-pushed the frankcalise/fix-spaces-path-ios-template branch from aaec1bf to 0c3d081 Compare October 16, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spaces in folder name breaks iOS build PhaseScriptExecution [CP-User]\ Generate\ Specs

4 participants