Home

Awesome

ios-debug · iOS Debugging in VS Code

Debug iOS apps directly from VS Code.

Screen capture showing demo of iOS debugging if VS Code

Features

Requirements

Quick Start

Here is a minimal launch configuration to get you started

{
    "name": "Launch App",
    "type": "lldb",
    "request": "launch",
    "program": "${workspaceFolder}/build/Debug-${command:ios-debug.targetSdk}/<app name>.app",
    "iosBundleId": "<app bundle identifier>",
    "iosTarget": "select",
},

Look at the examples/Sample App/.vscode for a working example of VS Code config for a sample app.

How to use

Launch config options

The extension depends on CodeLLDB for most debugging features and extends the same to support launching and attaching to iOS targets.

Here are some of the common options used for setting up the launch config for debugging on iOS.

When request is set to launch, the app is launched on the iOS device or simulator and attached for debugging. When request is set to attach, the debugger tries to attach to the app already launched on the iOS device or simulator.

parametertypereq
namestringYLaunch configuration name.
typestringYSet to lldb.
requeststringYSet to launch or attach.
programstringYPath to the built <name>.app file for your app.
iosBundleIdstringYApp bundle identifier for the specified app.
iosTargetstringYIf this config should target iOS.<ul><li>false (default) if this config is not for iOS debugging</li><li>"select" if the target picker should be shown</li><li>"last-selected" if last selected target should be used if available</li></ul>
iosInstallAppstringWhether to install the app on target before launching. Only available with request = launch. <ul><li>true (default) Install the app specified by program before launching.</li><li>false Do not install the app. Directly launch the already installed app on the target.</li></ul>
args[string]Command line parameters to pass while launching the app. Only available with request = launch.
envdictionaryAdditional environment variables when launching the app. Only available with request = launch.

Target selection

If you specify "iosTarget": "select" in your launch config, the target picket will be shown when you start the debugging.

If you want to select or change target otherwise, you can do that by the following methods.

Commands

The extension exposes a few commands that can be used in tasks or launch config as parameters. You can use ${command:ios-debug.<command>} inside your launch configs or task definitions, which will be resolved to the return value of the command.

Remote Development

The extension supports debugging on locally connected devices when using VS Code Remote Development. If the setup is correct, the locally connected devices will automatically be listed in the target picker.

iOS Debug Companion extension is required for this to work. It'll automatically prompt to install this extension when needed.

ios-debug.shareLocalDevices configuration can be tweaked to control whether to allow debugging on local devices or not based on your requirements.

Your local machine may need additional setup for this to work depending on the OS.

Known limitations