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"
?
This question is related to
ios
react-native
npm install -g ios-deploy
react-native run-ios --device "______\'s iPhone"
Found Xcode project ________.xcodeproj
Could not find device with the name: "_______'s iPhone".
Choose one of the following:
______’s iPhone Udid: _________
react-native run-ios --udid 0412e2c230a14e23451699
react-native run-ios --udid 0412e2c230a14e23451699 -- configuration Release
Actually, For the first build, please do it with Xcode and then do the following way:
brew install ios-deploy
npx react-native run-ios --device
The second command will run the app on the first connected device.
Run this command in project root directory.
1>. List of iPhone devices for found the connected Real Devices and Simulator. same as like adb devices command for android.
xcrun instruments -s devices
2>. Select device using this command which you want to run your app
Using Device Name
react-native run-ios --device "Kool's iPhone"
Using UDID
react-native run-ios --device --udid 0412e2c2******51699
wait and watch to run your app in specific devices - K00L ;)
Got mine working with
react-native run-ios --device="My’s iPhone"
And notice that your iphone name, the apostrophe s ' might be different. Mine is using this ’
If you get this error [email protected] preinstall: ./src/scripts/check_reqs.js && xcodebuild ...
using npm install -g ios-deploy
Try this. It works for me:
sudo npm uninstall -g ios-deploy
brew install ios-deploy
Just wanted to add something to Kamil's answer
After following the steps, I still got an error,
error Could not find device with the name: "....'s Xr"
After removing special characters from the device name (Go to Settings -> General -> About -> Name)
Eg: '
It Worked !
Hope this will help someone who faced similar issue.
Tested with - react-native-cli: 2.0.1 | react-native: 0.59.8 | VSCode 1.32 | Xcode 10.2.1 | iOS 12.3
Source: Stackoverflow.com