我已经看了很多教程,但是似乎无法让Vscode在设备上启动我的React Native应用程序。我可以在模拟器上正常运行,但是当我使用以下配置时:
{
"name": "Can's iPhone",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"target": "device",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react",
},
它只是在上次使用的模拟器中而不是在设备中启动应用程序。我也尝试过:
{
"name": "Can's iPhone",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"target": "device",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react",
"runArguments": [
"--device",
"EXACT_NAME_OF_MY_DEVICE"
],
},
EXACT_NAME_OF_MY_DEVICE
是我设备的确切名称,但无济于事;它仍然在模拟器中运行。当我在Xcode中选择设备并运行时,它运行正常(但是我想使用Vscode调试TS)我在做什么错了?
答案 0 :(得分:1)
看看下面的链接。这是一个实验包: https://github.com/Microsoft/vscode-react-native/blob/master/doc/debugging.md#debugging-on-ios-device 默认情况下,React-Native CLI不允许在设备上运行。您必须通过xcode启动。