xCode 12 is escaping equal signs in the build output that is parsed here, this regex will not match the new format:
Example of the relevant line in xCode 12 build output:
export FULL_PRODUCT_NAME\=AppName.app
Current Regex: /export FULL_PRODUCT_NAME="?(.+).app"?$/m
Working Regex: /export FULL_PRODUCT_NAME\\?="?(.+).app"?$/m
This manifests as the following error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier /Users/tim/Library/Developer/Xcode/DerivedData/AppName-garbledstring/Build/Products/Debug-iphonesimulator/Schema Name.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
I'm also seeing this. Xcode Version 12.0.1 (12A7300)
What's strange... if I take the buildOutput from the function and run the regex on it in a JS console, I get it the expected appName. I did this by copying the build output, pasting it into a JS browser console, and running the regex function against it. When I added a log to the RN run iOS function, it outputs nothing for the result.
I'm also seeing this.
Xcode Version 12.0.1 (12A7300)What's strange... if I take the buildOutput from the function and run the regex on it in a JS console, I get it the expected appName. I did this by copying the build output, pasting it into a JS browser console, and running the regex function against it. When I added a log to the RN run iOS function, it outputs nothing for the result.
@jefflewis can you verify pasting it into the browser console keeps the escape backslash before the equal signs? Any regex parser I tried returned null, which is expected given the added character
There may be something in how I'm getting the string that makes a difference, but what I did...
script build.txt
react-native run-ios --scheme MyScheme --configuration MyConfiguration --simulator="iPhone 11 Pro" --verbose
exit
I removed all the [0m type characters from that text file, and pasted into my console. Running the regex gets me: ["export FULL_PRODUCT_NAME=My Awesome App Name.app", "My Awesome App Name"] (2) = $3
The money piece is this though: export FULL_PRODUCT_NAME\=My\ Awesome\ App\ Name.app is in the buildOutput.
So what I did to get the string we're parsing is console.logging the buildOutput param inside the RN function, but I guess the output should be identical (can't verify at the moment).
It's interesting that apparently Xcode isn't only escaping the equal sign but the entire declaration, as opposed to quoting the variable value as it did before
I'm also hitting this.
Additional quirk is, in my case, the FULL_PRODUCT_NAME contains an exclamation mark. Which means that even if the regex is replaced as suggested by @fuchstim, it won't work for me, because Xcode actually outputs
export FULL_PRODUCT_NAME\=Example\!.app
(note the \!) when the app is actually named Example!.
So the proper solution would need to unescape all backslash-escaped characters, not just the \=. Or, better yet, to call out to the shell, since this is Bourne shell syntax:
sh -c 'export FULL_PRODUCT_NAME\=Example\!.app; echo ${FULL_PRODUCT_NAME%.app}'
Example!
(Not sure how to do this, since I'm not a Node person).
As a local workaround, I've monkey-patched node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js and edited getProductName (lines 339–342) to read:
function getProductName(buildOutput) {
const productNameMatch = /export FULL_PRODUCT_NAME\\?="?(.+).app"?$/m.exec(buildOutput);
return productNameMatch ? productNameMatch[1].replace(/(?:\\(.))/g, '$1') : null;
}
Also seeing this issue since upgrading to Xcode 12.
Thanks for reporting. Will be fixed by https://github.com/react-native-community/cli/pull/1326
I'm also hitting this.
Additional quirk is, in my case, the
FULL_PRODUCT_NAMEcontains an exclamation mark. Which means that even if the regex is replaced as suggested by @fuchstim, it won't work for me, because Xcode actually outputs
export FULL_PRODUCT_NAME\=Example\!.app(note the
\!) when the app is actually namedExample!.So the proper solution would need to unescape all backslash-escaped characters, not just the
\=. Or, better yet, to call out to the shell, since this is Bourne shell syntax:sh -c 'export FULL_PRODUCT_NAME\=Example\!.app; echo ${FULL_PRODUCT_NAME%.app}' Example!(Not sure how to do this, since I'm not a Node person).
As a local workaround, I've monkey-patched
node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.jsand editedgetProductName(lines 339–342) to read:function getProductName(buildOutput) { const productNameMatch = /export FULL_PRODUCT_NAME\\?="?(.+).app"?$/m.exec(buildOutput); return productNameMatch ? productNameMatch[1].replace(/(?:\\(.))/g, '$1') : null; }
This worked for me too, but I tried updating the @react-native-community/cli-platform-ios to the latest version and even the 6.0.0 rc and 4.14.0, but I still have this issue and I have to use your patch. What is the best way to fix this without having to edit react-native CLI code?
I opted to link the images from the Images.xcassets package in iOS to fix the images missing in IPA problem for now until the script issue is fixed.
Most helpful comment
I'm also hitting this.
Additional quirk is, in my case, the
FULL_PRODUCT_NAMEcontains an exclamation mark. Which means that even if the regex is replaced as suggested by @fuchstim, it won't work for me, because Xcode actually outputsexport FULL_PRODUCT_NAME\=Example\!.app(note the
\!) when the app is actually namedExample!.So the proper solution would need to unescape all backslash-escaped characters, not just the
\=. Or, better yet, to call out to the shell, since this is Bourne shell syntax:(Not sure how to do this, since I'm not a Node person).
As a local workaround, I've monkey-patched
node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.jsand editedgetProductName(lines 339–342) to read: