Environment
@revopush/code-push-cli 0.0.13, react-native 0.84.1, macOS. Project uses the modern Xcode versioning style: Info.plist contains $(MARKETING_VERSION) / $(CURRENT_PROJECT_VERSION) placeholders, actual values live in project.pbxproj.
Symptom
Running release-react for iOS without --target-binary-version fails during version auto-detection:
Detecting ios app version:
[Error] The "CURRENT_PROJECT_VERSION" key doesn't exist in the "ios/<App>.xcodeproj/project.pbxproj" file.
…even though the key exists in every build configuration. The trigger: our project's build number is literally 0 (CURRENT_PROJECT_VERSION = 0;).
Root cause
In getAppVersionFromXcodeProject (bin/script/command-executor.js, line ~779 in 0.0.13):
const currentProjectVersion = xcodeProj.getBuildProperty("CURRENT_PROJECT_VERSION", ...);
if (!currentProjectVersion) {
throw new Error(`The "CURRENT_PROJECT_VERSION" key doesn't exist ...`);
}
The xcode package returns the number 0 for CURRENT_PROJECT_VERSION = 0;, and !0 is true — so a present-and-parsed value is reported as a missing key.
Verification (A/B with the CLI's own code)
We invoked the CLI's getReactNativeProjectVersionInfo directly against two copies of the same project differing only in that one value:
CURRENT_PROJECT_VERSION = 0; → throws the error above.
CURRENT_PROJECT_VERSION = 1; → {"appVersion":"4.0.0","buildNumber":"1"} — detection succeeds.
Suggested fix
Check for absence rather than falsiness, e.g.:
if (currentProjectVersion == null) { ... }
return Q({ appVersion: marketingVersion, buildNumber: String(currentProjectVersion) });
(The existing String(currentProjectVersion) on the return already handles the numeric type; only the guard is wrong.) A clearer error message distinguishing "key not found" from "value invalid" would also help — the current one sent us hunting for a missing key that wasn't missing.
Workaround
Pass --target-binary-version explicitly, which skips detection entirely.
Context: found while hardening our release scripts after #40 — same app, different code path.
Environment
@revopush/code-push-cli0.0.13, react-native 0.84.1, macOS. Project uses the modern Xcode versioning style:Info.plistcontains$(MARKETING_VERSION)/$(CURRENT_PROJECT_VERSION)placeholders, actual values live inproject.pbxproj.Symptom
Running
release-reactfor iOS without--target-binary-versionfails during version auto-detection:…even though the key exists in every build configuration. The trigger: our project's build number is literally
0(CURRENT_PROJECT_VERSION = 0;).Root cause
In
getAppVersionFromXcodeProject(bin/script/command-executor.js, line ~779 in 0.0.13):The
xcodepackage returns the number0forCURRENT_PROJECT_VERSION = 0;, and!0istrue— so a present-and-parsed value is reported as a missing key.Verification (A/B with the CLI's own code)
We invoked the CLI's
getReactNativeProjectVersionInfodirectly against two copies of the same project differing only in that one value:CURRENT_PROJECT_VERSION = 0;→ throws the error above.CURRENT_PROJECT_VERSION = 1;→{"appVersion":"4.0.0","buildNumber":"1"}— detection succeeds.Suggested fix
Check for absence rather than falsiness, e.g.:
(The existing
String(currentProjectVersion)on the return already handles the numeric type; only the guard is wrong.) A clearer error message distinguishing "key not found" from "value invalid" would also help — the current one sent us hunting for a missing key that wasn't missing.Workaround
Pass
--target-binary-versionexplicitly, which skips detection entirely.Context: found while hardening our release scripts after #40 — same app, different code path.