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

Choose Simulator iOS version #10288

Closed
Amurmurmur opened this issue Oct 7, 2016 · 26 comments
Closed

Choose Simulator iOS version #10288

Amurmurmur opened this issue Oct 7, 2016 · 26 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Amurmurmur
Copy link

React-native v0.34

Anyway to choose a simulator's ios version to run?
I have list of simulators with iOS 9.3 and iOS 10.

When using --simulator it picks the simulator device with latest iOS which is 10.

Setting deployment target to 9.3 in the project settings doesnt help :/

Maybe a flag --iosversion would be beneficial in the next release.

Thank you very much in advance,

@davidck
Copy link

davidck commented Oct 9, 2016

+1 but until then, you can manually build and archive your project via XCode

@rturk
Copy link

rturk commented Oct 10, 2016

@Amurmurmur this looks like a question related to Xcode usage. Please refer to Apple documentation

@pvinis
Copy link
Contributor

pvinis commented Oct 14, 2016

this is not an xcode usage problem. xcode can do what i said in #10284. it how the cli uses xcode.

@Amurmurmur
Copy link
Author

I found "solution" just delete duplicate simulators with different ios versions

I simply removed iPhone 6 10.0 simulator and by default react-native runs iPhone 6 with 9.3

@pvinis
Copy link
Contributor

pvinis commented Oct 15, 2016

how about when i want to run two simulators of the same iphone and ios, but different name, and run something on one, run something else on the other?

christopherdro added a commit to christopherdro/react-native that referenced this issue Oct 15, 2016
Although I'm a strong advocate of using Xcode, I noticed a combination of issues requesting support for running a specific iOS version with `react-native run-ios`.

This is a follow up for changes that were made in the recent past.

facebook@48ab5eb
facebook@8b55e50

Tested using both `--device` and `--udid ` with various simulator options and devices.

Closes facebook#10288
christopherdro added a commit to christopherdro/react-native that referenced this issue Oct 17, 2016
Although I'm a strong advocate of using Xcode, I noticed a combination of issues requesting support for running a specific iOS version with `react-native run-ios`.

This is a follow up for changes that were made in the recent past.

facebook@48ab5eb
facebook@8b55e50

Tested using both `--device` and `--udid ` with various simulator options and devices.

Closes facebook#10288
christopherdro added a commit to christopherdro/react-native that referenced this issue Oct 17, 2016
Although I'm a strong advocate of using Xcode, I noticed a combination of issues requesting support for running a specific iOS version with `react-native run-ios`.

This is a follow up for changes that were made in the recent past.

facebook@48ab5eb
facebook@8b55e50

Tested using both `--device` and `--udid ` with various simulator options and devices.

Closes facebook#10288
christopherdro added a commit to christopherdro/react-native that referenced this issue Nov 11, 2016
Although I'm a strong advocate of using Xcode, I noticed a combination of issues requesting support for running a specific iOS version with `react-native run-ios`.

This is a follow up for changes that were made in the recent past.

facebook@48ab5eb
facebook@8b55e50

Tested using both `--device` and `--udid ` with various simulator options and devices.

Closes facebook#10288
christopherdro added a commit to christopherdro/react-native that referenced this issue Dec 7, 2016
Although I'm a strong advocate of using Xcode, I noticed a combination of issues requesting support for running a specific iOS version with `react-native run-ios`.

This is a follow up for changes that were made in the recent past.

facebook@48ab5eb
facebook@8b55e50

Tested using both `--device` and `--udid ` with various simulator options and devices.

Closes facebook#10288
@lacker
Copy link
Contributor

lacker commented Feb 10, 2017

It seems like there is a reasonable workaround here so I am going to close this issue. Thanks folks for chiming in to help answer this!

@lacker lacker closed this as completed Feb 10, 2017
@mfclarke
Copy link

@lacker this is a workaround, but not a reasonable one IMO. It requires uninstalling and reinstalling simulators when you want to change the iOS version that react-native run-ios uses.

@gotoAndBliss
Copy link

If I run react-native run-ios after upgrading to 0.44.0, I get

xcodebuild: error: SDK "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk" cannot be located.
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH

Command failed: xcrun instruments -s
xcodebuild: error: SDK "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk" cannot be located.
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH`

Hmm.. looks like 10.2 is still getting called.

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
> ls
iPhoneSimulator.sdk	iPhoneSimulator10.3.sdk

Where is this 10.2 locked? I tried reinstalling ReactNative a few times, manually and with the Git Tool. It still seems pretty intent on 10.2

@hendricius
Copy link

I have the same question. Is there any way how this can be specified? Are the UUIDs unique? Or are they the same on my local machine and on other machines? Trying to run iPhone 6 with iOS 10.3

@spinningarrow
Copy link

Vote to reopen. It seems like which iOS version is used is random when multiple ones are installed. It would be really useful to have an option that can configure this!

@njt1982
Copy link

njt1982 commented Oct 2, 2017

@spinningarrow agreed; mine just opened with iPhone 6 9.1 even though the apps deployment target is 9.3... Took me several minutes to debug why the app was dying immediately on opening! I didn't even know I had 9.1 installed...

@comur
Copy link

comur commented Oct 11, 2017

+1 to reopen, mine is iPhone 6 8.4

@ghost
Copy link

ghost commented Nov 7, 2017

+1

@rajivshah3
Copy link
Contributor

This is still happening with the iOS 11.1 simulator

@comur
Copy link

comur commented Nov 16, 2017

Actually it works for me now if you launch a simulator of your choice (and only one) and then run react-native run-ios, it will use actually launched simulator.

@njt1982
Copy link

njt1982 commented Nov 16, 2017

@comur That's slightly different - that's preloading the simulator and react will use the already open one.

The feature request is to be able to specify the version when launching it... Or at least have the launcher know if your project settings define a minimum version, to not use anything less than that.

@justynspooner
Copy link

I'm also hitting this issue and would like to see it re-opened. Would be great to have three features added in relation to the issue:

  • Ability to specify the OS version via a flag
  • If no flag is set, then it should autodetect the minimum version and use that
  • Ability to set a default device and OS version which persists between runs

@hysan
Copy link

hysan commented Jan 6, 2018

So I investigated this issue and figured out that the fix for #9414 that added the ability to run on devices broke the original functionality of the --simulator flag. I differ the code and was able to see where the logic change was made. I'm my local repository, I was able to fix this and change the behavior to match the old way it worked as explained in #10246. However, the documentation and --help don't really explain any of the nuances of how run-ios should behave when flags are mixed (or precedence, or with multiple simulators as is being implemented right now in #17284). This all leaves me at a bit of a blocker wondering:

  • How should all of the flags work and should they work in conjunction with each other?
  • Should version instead be split into a separate flag as suggested by @justynspooner?

Aside from waiting on a decision for #17284, as that affects the same files and would require a merge for a fix, I don't know if I should be committing any additional time into cleaning up the code logic and writing new tests. Thoughts? Could someone with decision making power chime in here?

Sidenote: While examining the code and commit changes, I found an unintended workaround that doesn't require deleting and reinstalling simulators.

Despite what --help says and the names of the functions in the code, you can use the --udid by itself (don't specify any --device or --simulator) to run on a specific simulator. You can get your list of simulators with their unique udids with xcrun simctl list devices. I don't know if this is the workaround that @lacker was thinking of, but it works for now (it's actually a bug based on how everything is written and explained).

Edit: My mistake on the workaround. I was testing on a different code branch where I was working on a udid fix that should address the non-merged closed PR #10405. --udid won't work as I explained above at the moment.

@adbl
Copy link
Contributor

adbl commented Jan 17, 2018

Please reopen

@ghost
Copy link

ghost commented Jan 18, 2018

I executed the command with 'sudo' and it worked.

sudo react-native run-ios

@mikenk2010
Copy link

Never ever run with sudo when you wanna build react native app, this will lead to more and more trouble.

@patrickholley
Copy link

patrickholley commented Apr 16, 2018

This is still an issue, but a decent workaround exists.

Launch XCode, select Window > Devices and Simulators, then open the Simulator tab. Rename the simulators you need to whatever you want. You can then use the --simulator option to launch your preferred simulator using the new name.

For example, I renamed my iPhone 6 with versions 9.0 and 11.2 to "Nonary" and "Elevensies" respectively. My command would look like --simulator "Nonary" or --simulator "Elevensies".

It'd be really good to see an update where you can actually set the iOS version without any workaround, however.

@Rob117
Copy link

Rob117 commented Apr 26, 2018

Completely agree, OS version should be specifiable @lacker

@lasersonic
Copy link

I think @patrickholley 's workaround is the best thing we can do now

@rikur
Copy link

rikur commented May 23, 2018

@lacker please reopen. A clunky workaround doesn't count as a fix.

@dkpalmer
Copy link

Agreed. We have CI that comes with simulators pre-loaded. Renaming and/or uninstalling is definitely not ideal.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 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