Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] react-native run-ios --scheme XXX work incorrectly #10102

Closed
xareelee opened this issue Sep 26, 2016 · 14 comments
Closed

[cli] react-native run-ios --scheme XXX work incorrectly #10102

xareelee opened this issue Sep 26, 2016 · 14 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@xareelee
Copy link

I have two targets/schemes in the iOS project: one is for production; the other one is for staging.

I tried to run react-native run-ios with different scheme params for --scheme, but it always launch the production target even choosing staging scheme.

$ react-native run-ios --scheme MyAppProduction
$ react-native run-ios --scheme MyAppStaging

The xcodebuild works correctly:

$ "xcodebuild -workspace MyApp.xcworkspace -scheme MyAppStaging -destination id=16ABE1A9-XXXX-XXXX-XXXX-650DA9457D6C -derivedDataPath build"

but after build succeeded, the install wrong app and launch wrong App ID.

// Build the MyAppStaging.app
Touch build/Build/Products/Debug-iphonesimulator/MyAppStaging.app

...

** BUILD SUCCEEDED **

// Install and launch MyApp.app (production)
Installing build/Build/Products/Debug-iphonesimulator/MyApp.app
Launching com.MyApp.XXX.XXX
com.MyApp.XXX.XXX: 9851
@lsps9150414
Copy link

Also want to know the correct way to use react-native run-ios --scheme. Is there any documentation?

@chrisknepper
Copy link
Contributor

I am having the same issue. It is because the CLI is coded incorrectly. While the scheme that you pass will be built, it will not actually push the equivalent scheme to the simulator/device.

The problem is on line 91 of the CLI runIOS.js:

const appPath = `build/Build/Products/Debug-iphonesimulator/${inferredSchemeName}.app`;

Two problems with this:

  1. "Debug-iphonesimulator" is hardcoded and shouldn't be. A non-default scheme would be in a different directory.
  2. inferredSchemeName is still passed, even if scheme was passed to the command.

You can still build different schemes with a React-Native project through Xcode though.

@chrisknepper
Copy link
Contributor

Just to let everyone know, this appears to be fixed in master via this commit, so hopefully we see it in one of the upcoming RN releases.

@bmcmillan
Copy link

What's the status of this bug? It's May 19th 2017 at v0.44 and this is still happening.

FWIW, react-native link also only cares about the main scheme, and not other schemes.

@eddnav
Copy link

eddnav commented May 29, 2017

FWIW, react-native link also only cares about the main scheme, and not other schemes.

@bmcmillan is this true? that's a really serious problem, if possible, would you mind telling me what workaround are you using for that? Schemes are absolutely necessary...

@bmcmillan
Copy link

@eddnav yes, absolutely true. The workaround is to do all of it manually. I have 4 other schemes, so that's a PITA.

@jordanmkoncz
Copy link

Ran into this issue today when starting up a new project with the latest version of React Native (0.45.1). I had previously been using 0.41.2 and had a separate MyAppDev scheme that was duplicated from the default MyApp scheme and had some minor changes, and everything was all working fine. Now with 0.45.1, when I try to run in a simulator using react-native run-ios --scheme MyAppDev, I get the following error:

Installing build/Build/Products/Debug-iphonesimulator/MyAppDev.app
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

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/MyAppDev.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

I believe the reason it's failing is it mistakenly thinks it should be using MyAppDev.app when it is supposed to use MyApp.app. I think it might be doing this because of the code at https://github.com/facebook/react-native/blob/master/local-cli/runIOS/runIOS.js#L97 where it falls back to the scheme name?

@tizzyapunkt
Copy link

@jordanmkoncz I got exactly the same problem, working with schemes seems not to work in this update. building via Xcode GUI does not work either for me.

@hdchan
Copy link

hdchan commented Jul 3, 2017

Was there any solution to this? Running react-native run-ios --scheme xxx did not seem to work for me.

@jkimbo
Copy link
Contributor

jkimbo commented Jul 27, 2017

@jordanmkoncz @hdchan I ran across the same issue today and it looks like it had been fixed: 242d29d

Upgrading to v0.46 should fix it.

@southerneer
Copy link

@jkimbo did it work for you? That PR only mentions the "--configuration" flag, but maybe it also affects "--scheme" (?)

@jkimbo
Copy link
Contributor

jkimbo commented Jul 27, 2017

@southerneer yep it worked for scheme too. I have a Staging configuration setup as well as a MyApp Staging scheme so the command that works is:
react-native run-ios --scheme "MyApp Staging" --configuration Staging

@hramos
Copy link
Contributor

hramos commented Aug 3, 2017

Duplicate of #14447

@hramos hramos marked this as a duplicate of #14447 Aug 3, 2017
@hramos hramos closed this as completed Aug 3, 2017
@hramos
Copy link
Contributor

hramos commented Aug 3, 2017

Duplicate of #14423

@hramos hramos marked this as a duplicate of #14423 Aug 3, 2017
@facebook facebook locked and limited conversation to collaborators Aug 3, 2017
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests