[React Native(RN)/iOS] How can i App build iOS Simulator or Real Device Change?



1. Problem

$ react-native run-ios
or
$ yarn nx run-ios mobile
or
$ npx react-native run-ios

If you proceed with the mobile build with the above command, you can only check the basic simulator. If i want to change to ipad simulator or real device phone. How can I change the simulator?

image

2. Solution

First, you can confirm your simulator devices.

$ xcrun simctl list devices

You can confirm your devices auid and model name.

== Devices ==
-- iOS 15.5 --
    iPhone 8 (8C682EAD-74AE-42EA-A8E5-AAAAAAAAAAAA) (Shutdown) 
    iPhone 8 Plus (A5C7F0B2-89B5-4363-8662-AAAAAAAAAAAA) (Shutdown) 
    iPhone 11 (B210D795-3C7A-4BCB-8288-AAAAAAAAAAAA) (Shutdown) 
    iPhone 11 Pro (02EC2F36-FB7E-4721-8D13-AAAAAAAAAAAA) (Shutdown) 
    iPhone 11 Pro Max (0BA4CD71-8BC5-4257-908E-AAAAAAAAAAAA) (Shutdown) 
    iPhone 12 mini (E0ECFC02-C989-4D61-8278-AAAAAAAAAAAA) (Shutdown) 
    iPhone 12 (FF842588-55A1-4503-9610-AAAAAAAAAAAA) (Shutdown) 
    iPhone 12 Pro (B2CE2C55-A110-4491-BA84-AAAAAAAAAAAA) (Shutdown) 
    iPhone 12 Pro Max (3396D961-60CD-4AAC-A118-AAAAAAAAAAAA) (Shutdown) 
    iPhone 13 Pro (26054997-CC17-49A3-8E59-AAAAAAAAAAAA) (Shutdown) 
    iPhone 13 Pro Max (90A238CC-7C2F-4D49-B4BA-AAAAAAAAAAAA) (Shutdown) 
    iPhone 13 mini (FA538DC5-02A1-4C06-BA8C-AAAAAAAAAAAA) (Shutdown) 
    iPhone 13 (7B9016C4-9E8C-4D13-AAE0-AAAAAAAAAAAA) (Booted) 
    iPhone SE (3rd generation) (531D72B6-1235-4111-820E-AAAAAAAAAAAA) (Shutdown) 
    iPod touch (7th generation) (6F97B119-B79A-456B-9726-AAAAAAAAAAAA) (Shutdown) 
    iPad Pro (9.7-inch) (43DAE838-A46A-431B-8BDA-AAAAAAAAAAAA) (Shutdown) 
    iPad (9th generation) (E24E2D07-593B-4166-989F-AAAAAAAAAAAA) (Shutdown) 
    iPad Pro (11-inch) (3rd generation) (0086C636-98A7-442D-B131-AAAAAAAAAAAA) (Shutdown) 
    iPad Pro (12.9-inch) (5th generation) (D2C6A0BC-A8A8-4965-B86A-AAAAAAAAAAAA) (Booted) 
    iPad Air (5th generation) (5FBB1736-E115-4D02-AC63-AAAAAAAAAAAA) (Shutdown) 
    iPad mini (6th generation) (E47964F6-36E7-4177-9F21-AAAAAAAAAAAA) (Shutdown) 
-- tvOS 15.4 --
    Apple TV (261C751E-CD07-4440-868C-AAAAAAAAAAAA) (Shutdown) 
    Apple TV 4K (2nd generation) (DD30F2E3-650D-40BA-9D43-AAAAAAAAAAAA) (Shutdown) 
    Apple TV 4K (at 1080p) (2nd generation) (3DA5FBA4-BDC0-4662-BE61-AAAAAAAAAAAA) (Shutdown) 
-- watchOS 8.5 --
    Apple Watch Series 3 - 38mm (A9C9068C-8BA4-490F-B927-AAAAAAAAAAAA) (Shutdown) 
    Apple Watch Series 5 - 40mm (BB92C7C1-F79C-4E79-9AB6-AAAAAAAAAAAA) (Shutdown) 
    Apple Watch Series 5 - 44mm (4DDBE33C-78C9-4731-9EF2-AAAAAAAAAAAA) (Shutdown) 
    Apple Watch Series 6 - 40mm (D53DDC51-3031-48C4-9350-AAAAAAAAAAAA) (Shutdown) 
    Apple Watch Series 6 - 44mm (B4A15EF5-1D91-4D93-82E5-AAAAAAAAAAAA) (Shutdown) 
    Apple Watch Series 7 - 41mm (E0CDDC70-0CE4-43A2-8A72-AAAAAAAAAAAA) (Shutdown) 
    Apple Watch Series 7 - 45mm (18F3E8DC-A04E-44D6-AE4A-AAAAAAAAAAAA) (Shutdown)

And you can choose under option. --simulator or --udid is good option.

2.1. using --simulator

$ react-native run-ios --simulator="iPhone SE"
or
$ yarn nx run-ios mobile --simulator="iPhone SE"
or
$ npx react-native run-ios --simulator="iPhone SE"

2.2. using --udid

$ react-native run-ios --udid 90953319-BF9A-4C6E-8AB1-594394AD26CE
or
$ yarn nx run-ios mobile --udid 90953319-BF9A-4C6E-8AB1-594394AD26CE
or
$ npx react-native run-ios --udid 90953319-BF9A-4C6E-8AB1-594394AD26CE

Now, you can boot another device! Thanks for your read this article.