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"
?
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.
React-Native provides command line utilities to run an app on iOS and Andriod simulators/devices.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With