Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Change Default iOS Simulator Device

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?

like image 802
Wonka Avatar asked May 19 '16 16:05

Wonka


People also ask

How do I change the simulator in React Native iOS?

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)' .

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

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.

How do I change the default simulator in Xcode?

In Xcode, go to Product -> Destination -> Choose Destination menu and selecting the device you'd like to be your default.


1 Answers

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

like image 80
Daniel Basedow Avatar answered Sep 28 '22 04:09

Daniel Basedow