adhdj
adhdj

Reputation: 352

Change iOS simulator device in launch.js for react native project

I am looking to modify launch.json such that I can change the simulated iOS device used to debug a react native app. The default configuration for debugging an iOS reactive native app looks like this:

{
        "name": "Debug iOS",
        "program": "${workspaceRoot}/.vscode/launchReactNative.js",
        "type": "reactnative",
        "request": "launch",
        "platform": "ios",
        "sourceMaps": true,
        "outDir": "${workspaceRoot}/.vscode/.react"
}

I have tried changing the "name" field to one of the device names in the list generated by running

xcrun simctl list devices

For example, I have set

"name": "iPhone 7"

But this does not work. I am aware of the solution posted at https://stackoverflow.com/a/37329896/5563513 but I am looking to see if (and if so, how) I can set the simulated device in launch.json.

Upvotes: 0

Views: 1583

Answers (1)

Onur Var
Onur Var

Reputation: 1808

Add the lines below into your .vscode/settings.json file (create if now exist)

{
    "react-native.ios.runArguments.simulator": [
        "--simulator", "iPhone 6"
    ]
}

Upvotes: 3

Related Questions