Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run react-native application on iOS device directly from command line?

Is it possible to run react-native application on an iOS device directly from the command line like we do on simulator with react-native run ios --simulator "iPhone 5s"?

like image 385
Aakash Sigdel Avatar asked Jul 21 '16 05:07

Aakash Sigdel


People also ask

How do I run a React Native app on iOS physical device?

The first thing to do is to connect your iOS device to your Mac with a USB cable. Open your react native app's directory, navigate to ios folder, and double-click on . xcworkspace file to open the Xcode. Next, open the Product menu, go to Destination, and select your device.

Can React Native app run on iOS?

React-Native provides command line utilities to run an app on iOS and Andriod simulators/devices.


1 Answers

The following worked for me (tested on react native 0.38 and 0.40):

npm install -g ios-deploy # Run on a connected device, e.g. Max's iPhone: react-native run-ios --device "Max's iPhone" 

If you try to run run-ios, you will see that the script recommends to do npm install -g ios-deploy when it reach install step after building.

While the documentation on the various commands that react-native offers is a little sketchy, it is worth going to react-native/local-cli. There, you can see all the commands available and the code that they run - you can thus work out what switches are available for undocumented commands.

like image 52
Kamil Sarna Avatar answered Sep 19 '22 06:09

Kamil Sarna