When I run this command:
react-native run-ios
My app runs by default in the iPhone6 simulator device:
Found Xcode project RN.xcodeproj Launching iPhone 6 (9.2)...
How can I have the app run in a different simulator device (like iPhone5s) by default?
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 13" . If you wish to run your app on an iPhone SE (2nd generation), run npx react-native run-ios --simulator='iPhone SE (2nd generation)' .
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. If you don't have an Apple Developer account, you must create one to be able to run your project on an iOS device.
In Xcode, go to Product -> Destination -> Choose Destination menu and selecting the device you'd like to be your default.
Specify a simulator using the --simulator
flag.
These are the available devices for iOS 14.0 onwards:
npx react-native run-ios --simulator="iPhone 8" npx react-native run-ios --simulator="iPhone 8 Plus" npx react-native run-ios --simulator="iPhone 11" npx react-native run-ios --simulator="iPhone 11 Pro" npx react-native run-ios --simulator="iPhone 11 Pro Max" npx react-native run-ios --simulator="iPhone SE (2nd generation)" npx react-native run-ios --simulator="iPhone 12 mini" npx react-native run-ios --simulator="iPhone 12" npx react-native run-ios --simulator="iPhone 12 Pro" npx react-native run-ios --simulator="iPhone 12 Pro Max" npx react-native run-ios --simulator="iPhone 13 Pro" npx react-native run-ios --simulator="iPhone 13 Pro Max" npx react-native run-ios --simulator="iPhone 13 mini" npx react-native run-ios --simulator="iPhone 13" npx react-native run-ios --simulator="iPod touch (7th generation)" npx react-native run-ios --simulator="iPad Pro (9.7-inch)" npx react-native run-ios --simulator="iPad (9th generation)" npx react-native run-ios --simulator="iPad Air (4th generation)" npx react-native run-ios --simulator="iPad Pro (11-inch) (3rd generation)" npx react-native run-ios --simulator="iPad Pro (12.9-inch) (5th generation)" npx react-native run-ios --simulator="iPad mini (6th generation)"
List all available iOS devices:
xcrun simctl list devices
There is currently no way to set a default.
React Native Docs: Running On Simulator
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