66

I am new in expo and react-native Whenever i run the app from IOS simulator (inside expo) it always boots up the IphoneX. If i need to change the simulator,I have to open it through Xcode, is there any way we can change the default simulator ?

Hena Shiekh
  • 803
  • 3
  • 9
  • 13

12 Answers12

197

expo included an option in recent commits regarding this issue.

now you can tap shift+i on terminal which expo server is running.It will list all simulators and you need to select your choice.

https://github.com/expo/expo-cli/pull/2541

vamshi krishna
  • 2,618
  • 1
  • 11
  • 18
54

Currently there is no way of changing the simulator from Expo. Expo just uses the last opened simulator in Xcode.

If that doesn't work, try this (updated here from my comment) :

  1. When the simulator is open click on Hardware>Device> Select the other iphone.

  2. Now both will be open. Next exit the simulator from the dock.

  3. Now try and open your project in the ios simulator from expo. It should open in the Simulator you selected from the hardware menu.
Varun Nath
  • 5,570
  • 3
  • 23
  • 39
46

This worked for me on Feb 2021

on Mac OS with Big sur, expo v4.1.6

  1. Clean your EXPO cache with expo start -c (on your project location)
  2. In the expo terminal press shift + i (see screenshot below)

List item

  1. Then press shift + i and you should be able to select the Simulator by pressing enter on the one you need (see screnshot)enter image description here

lastly Just wanted to share all the available options if you just press i in the metro terminal window.

enter image description here

Jonathan Sanchez
  • 7,316
  • 1
  • 24
  • 20
12

It is possible, but you can't target it from the command line. Expo will just target the last opened simulator.

  1. Click on Hardware > Device and choose the device you desire

  2. You now have two simulators open, make sure the one you want is active.

  3. Now quit the simulator app with Command + Q

  4. Now in your command line, when running the expo server, just click i

  5. The simulator will open with your targeted device.

Sabba Keynejad
  • 7,895
  • 2
  • 26
  • 22
4

(As of December 3, 2020)

  1. Open Simulator
  2. Click on File ... (in the top-left menu bar)
  3. Click on Open Device ... (in the drop down list)
  4. Select your desired device and let it launch completely
  5. Quit Simulator ... (command + Q)
  6. Done

Running your app on iOS Simulator will automatically launch to this desired device now =)

BennyTheNerd
  • 3,930
  • 1
  • 21
  • 16
3

Change the open iOS simulator device(s), and Expo will use it.

Expo directs its output to the open iOS simulator, so this must be done in the simulator itself rather than in Expo. It is simple to do. You can direct expo output to different devices. Here's how. BTW, other approaches described here didn't work when I tried them.

Open a second simulator in iOS Simulator by:

1) select eg Simulator->Hardware->Device->iOS12.1->iPhone 8

2) Select the simulator that you don't want to use (eg the current default as of writing, iPhone XR). Press Command-W to close the simulator window, leaving the iPhone 8 simulator still running.

3) In Expo, deploy the code to simulator as usual, either using the i at the command line, or selecting 'run on iOS Simulator' from the browser version of Expo.

4) It is possible to get expo to display to more than one simulator that is running at once (eg to test rendering on multiple screen sizes). Once you get expo running on one device (steps 1-3), you can repeat on an additional device (or presumably more). Expo will then be running on multiple simulators. They will simultaneously display the output. When I change my code, it immediately updates to multiple simulators/screen sizes without requiring any additional steps. Haven't re-tested exactly the order of steps to do this most easily, but it's working.

Hope this works for you!

user2330237
  • 1,629
  • 5
  • 20
  • 39
2

Go to /Users/username/.expo/ios-simulator-app-cache/ and remove all files in there.

Run the ios simulator you want and run your expo project.

Derek Yang
  • 105
  • 3
  • 11
1

You just need to open the desirable simulator through Xcode, and then just run: npm run ios
from your project directory or a similar command to start your app

MAP Inc.
  • 17
  • 1
  • 8
1

I believe that yarn passes unrecognized arguments through to react-native run-ios, so you should be able to pass --simulator="foo" as described here: https://facebook.github.io/react-native/docs/running-on-simulator-ios.

Tim Keating
  • 6,443
  • 4
  • 47
  • 53
1

I know the exact answer Once you open the Simulator from the Expo, go to Help menu and Search for "iphone11", "iphoneX" .... Then you should be fine

Guvanch
  • 838
  • 7
  • 10
1

Restarting the computer was the only thing that worked for me. Without it pressing "Shift+i" had no effect. Neither Expo client would be installed on new simulator instance.

This was on macOS and M1 MacBook Pro for me.

Misha Reyzlin
  • 13,736
  • 4
  • 54
  • 63
  • 1
    Closing the active simulator (close window ⌘W) -> Opening the one I want -> Restart worked for me. – alpere May 07 '21 at 12:59
-1

Just launch simulator on which you want to run app and then run command i.e. "yarn run ios" or "npm run ios" to run on simulator. App will run on both simulator.

If it doesn't work then quit all simulator and then run the command i.e. "yarn run ios" or "npm run ios", then app automatically run on simulator which was latter launched.

Hope this may help you!

Vibha Thakur
  • 171
  • 1
  • 1
  • 10