React Native Run On Specific Simulator

Posted on  by

Expo CLI allows you to run your React Native app on a physical device without setting up a development environment. If you want to run your app on the iOS Simulator or an Android Virtual Device, please refer to the instructions for 'React Native CLI Quickstart' to learn how to install Xcode or set up your Android development environment. How to test React Native App on a real iPhone. I have been developing a new iOS app using React Native. I have been testing it using simulator provided by Xcode. Now it's time to test the app using a real device. One could ask why test on a real device if it works perfectly on a simulator. Here are some of the reasons. Now, we’re ready to use the react-native command to run our device on the simulator. Enter this command in your terminal and hit enter: react-native run-ios If it’s your first time running, you’ll see a lot of output and the process will take a little while. Don’t worry, that’s normal. React-Native provides command line utilities to run an app on iOS and defined in the runIOS.js file. Run-ios accepts certain options such as: How Run and Test React Native / Expo On Your Apple iOS Device and a FullStack Dev’s First Impressions With options like running Android device/emulator, and run iOS simulator. React-Native provides command line utilities to run an app on iOS and Andriod simulators/devices. Without further ado, let's try to understand the what and how of the process to run React-Native apps on iOS.

Starting the simulator

React Native Run On Specific Simulator Demo

Once you have your React Native project initialized, you can run react-native run-ios inside the newly created project directory. If everything is set up correctly, you should see your new app running in the iOS Simulator shortly.

Specifying a device

You can specify the device the simulator should run with the --simulator flag, followed by the device name as a string. The default is 'iPhone 6'. If you wish to run your app on an iPhone 4s, just run react-native run-ios --simulator='iPhone 4s'.

The device names correspond to the list of devices available in Xcode. You can check your available devices by running xcrun simctl list devices from the console.

React Native Run On Specific Simulator

Contents

Change the Default iOS Simulator

Hello Guys, In this post, you will see how to Change the Default iOS Simulator while Running React Native App. This is a small post that will help you to specify the iOS device while running any React Native project for iOS. So let’s get started.

How We Run our iOS App?

First of all, I want to highlight how we usually run our React Native app in the iOS simulator then we will see how to change the same command to run the app in the simulator you want. So to run any iOS app in the simulator we run

This command runs our app in the default simulator which is 'iPhone X' as per the official documents.

React Native Run On Specific Simulator Codes

How to Specifying a Device to Change Default iOS Simulator?

So as I mention if you run the run-ios command it will run the application in the default 'iPhone X' but if you want to specify a device or simulator you can do it with the --simulator flag, followed by the device name as a string.

So for example, if you wish to run your app on an iPhone 5s, run

React Native Run On Specific Simulator Download

This will run you React Native App in the iPhone 5s.

How to Get the iOS Device List?

Using an --simulator flag, followed by the device name is enough to run the app in a specific device but the question is how to get the list of device names so that we can use the correct device name?

To get the list of iOS devices available to use, you can use the following command from the console

React Native Run On Specific Simulator Xbox One

React native run on specific simulator codes

Screenshots to Get the List of Devices

Screenshots to Specifying a Device while Running iOS App

This is how to change the default iOS Simulator while Running React Native App. If you have any doubts or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂