Skip to content

fix(ios-template): escaped-quote form to bundle RN when spaces present in path#54172

Closed
frankcalise wants to merge 1 commit intofacebook:mainfrom
frankcalise:frankcalise/fix-spaces-path-ios-template
Closed

fix(ios-template): escaped-quote form to bundle RN when spaces present in path#54172
frankcalise wants to merge 1 commit intofacebook:mainfrom
frankcalise:frankcalise/fix-spaces-path-ios-template

Conversation

@frankcalise
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Yeah we'd need both

@frankcalise
Copy link
Copy Markdown
Collaborator Author

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

@cipolleschi
Copy link
Copy Markdown
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
Copy Markdown
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
@react-native-bot
Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 16, 2026
@react-native-bot
Copy link
Copy Markdown
Collaborator

This PR was closed because it has been stalled for 7 days with no activity.

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. Stale There has been a lack of activity on this issue and it may be closed soon.

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

5 participants