sweetpad icon indicating copy to clipboard operation
sweetpad copied to clipboard

Unable to debug on physical device

Open wr-fenglei opened this issue 5 months ago • 4 comments

Thank you very much for creating this plugin. I really like it.

However, I've found that I can't debug on a physical device. Is there something wrong with my configuration?

My plugin version is 0.1.33.

I'm using Xcode 15.2, and my phone's system is iOS 17.6.1.

My launch.json configuration is as follows:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "sweetpad-lldb",
            "request": "launch",
            "name": "Attach to running app (SweetPad)",
            "preLaunchTask": "sweetpad: launch",
        },
    ],
}

When I use VSCode's debug feature, the Terminal outputs:

Result bundle written to path:
Build Succeeded

🚀 Executing command:
xcrun devicectl device install app --device iosdevice-00008020-000B34D6012A003F /Users/myname/Library/Developer/Xcode/DerivedData/myapp-djwiypcpaflfvkbkckuttoyimesk/Build/Products/Debug-iphoneos/myapp.app

ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1000.)

🚫 Command returned non-zero exit code

When I use the command: SweetPad: Build & Run (Launch), the Terminal outputs:

Result bundle written to path:
Build Succeeded

🚀 Executing command:
xcrun devicectl device install app --device 00008020-000B34D6012A003F /Users/myname/Library/Developer/Xcode/DerivedData/myapp-djwiypcpaflfvkbkckuttoyimesk/Build/Products/Debug-iphoneos/myapp.app

21:59:41  Acquired tunnel connection to device.
21:59:41  Enabling developer disk image services.
21:59:41  Acquired usage assertion.
1%... 2%... 3%... 4%... 5%... 6%... 7%... 8%... 9%... 10%... 11%... 12%... 13%... 14%... 15%... 16%... 18%... 19%... 20%... 21%... 22%... 23%... 24%... 25%... 26%... 27%... 28%... 30%... 31%... 32%... 33%... 34%... 35%... 36%... 37%... 38%... 39%... 40%... 41%... 42%... 43%... 44%... 45%... 46%... 47%... 48%... 49%... 50%... 51%... 52%... 53%... 54%... 55%... 56%... 57%... 59%... 60%... 62%... 66%... 68%... 72%... 74%... 76%... 80%... 84%... 88%... 92%... 96%... Complete!
App installed:
? bundleID: com.myapp.ios
? installationURL: file:///private/var/containers/Bundle/Application/689DB382-C1B9-4626-B4D7-56ADEA7B5021/myapp.app/
? launchServicesIdentifier: unknown
? databaseUUID: E1D4A799-1D0D-4931-A385-74A49B4B3FD7
? databaseSequenceNumber: 1268
? options: 

🚀 Executing command:
xcrun devicectl device process launch --json-output '/Users/myname/Library/Application Support/Cursor/User/workspaceStorage/f8d9db3c1fcf7403dae4fe89e60093e3/sweetpad.sweetpad/_temp/json_f54f27f0' --terminate-existing --device 00008020-000B34D6012A003F com.myapp.ios

22:00:12  Acquired tunnel connection to device.
22:00:13  Enabling developer disk image services.
22:00:13  Acquired usage assertion.
Launched application with com.myapp.ios bundle identifier.

App launched on device with PID: 872
✅ Task completed

When using VSCode's debug feature, the --device parameter is: iosdevice-00008020-000B34D6012A003F (may be wrong)

When using SweetPad's debug feature, the --device parameter is: 00008020-000B34D6012A003F

Additionally, when I use SweetPad: Get app path for debugging, it pops up an error:

Sweetpad: No last launched app path found, please launch the app first using the extension

I've noticed that when running on a physical device, build.lastLaunchedAppPath is not updated. I'm not sure if this is related.

I would greatly appreciate if you could look into this issue. I'm really looking forward to debugging on a physical device.

wr-fenglei avatar Sep 19 '24 14:09 wr-fenglei