pni*_*zle 8 iphone configuration ios react-native visual-studio-code
我在 Visual Studio 代码中打开了一个 React Native 项目,并且尝试在物理连接的 iOS 设备上运行该项目。我直接从 Xcode 成功在设备上运行了该应用程序,但从 Visual Studio Code 中我遇到了问题。我相信我需要将设备的配置添加到 launch.json 中。我在那里尝试了不同的条目,但似乎不起作用。为连接的 iOS 设备添加配置的正确方法是什么?
如果您需要定位特定设备,\xc2\xb4s 就是这样完成的:
\n\n{\n "name": "iOS Device",\n "program": "${workspaceRoot}/.vscode/launchReactNative.js",\n "type": "reactnative",\n "request": "launch",\n "platform": "ios",\n "sourceMaps": true,\n "target": "device",\n "outDir": "${workspaceRoot}/.vscode/.react",\n "runArguments": [\n "--device",\n "DEVICE NAME"\n ],\n}\nRun Code Online (Sandbox Code Playgroud)\n\n所以你需要设置"target": "device"告诉调试器在一个设备上运行,然后你通过设置设备名称"runArguments"。
这就是我最终拥有的并设法让它在连接的设备上安装和启动。key 的值name似乎不能唯一标识所连接的设备。它只是“设备调试”下拉列表中显示的名称。
{
"name": "My iPad",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"target": "device",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8249 次 |
| 最近记录: |