Background Assets: How do I set breakpoints in the extension for debugging?

I've added a background downloads extension to my app and added device console logging to every method in the placeholder code created by XCode, and Setting a breakpoint, then installed the app to the phone.

When I run the following command: xcrun backgroundassets-debug --app-bundle-id com.myCompany.myApp --device-id 00008110-001E0DDA0AB8801E --simulate --app-update 

prompt: Application was updated event was sent for app identifier: (com.myCompany.myApp).

But the break point did not enter。Nothing is sent, and there is no log output

How do I set breakpoints in the extension for debugging?

  • same problem, any progress?

Add a Comment

Replies

Select the extension from the scheme selector, and bring up the scheme editor. Navigate to: Run->Launch and then select "Wait for executable to be launched.".

Now click the "Play" button, you'll see that Xcode will now show that its waiting on the extension to launch for it to attach. If you then invoke xcrun backgroundassets-debug, your extension will launch and the debugger will connect.

  • I hava the same problem, but this is not work for me, any other suggest?Thanks!

  • I did this without triggering a breakpoint. Do you have more detailed operation steps? Thank you very much!

Add a Comment

I hava the same problem, and change scheme not work for me, did you solve this? Thanks!

  • Have you verified the extension is actually launching by looking at logs? Your extension likely isn't being launched due to a configuration issue. Open Console.app and filter on Subsystem com.apple.BackgroundAssets

    The logging should indicate why your extension is not being launched.

  • I had log like this, the systems rejected because it has already run too long., but the extension not really run. why is this happed?

    默认 11:43:22.433511+0800 backgroundassets.user Download did begin: BAManifestDownload (0xe32e05e50) - com.gecko.ba.testBackgroundAssets.Manifest-AD801062-A64B-4654-B2C6-2CA56349B696

    错误 11:43:22.436049+0800 backgroundassets.user Rejecting launching extension for <private> because it has already run too long.

  • And there is another log like this:默认 16:53:57.581720+0800 CommCenter NEPathEvent Wi-Fi Blocked for com.gecko.ba.testBackgroundAssets by UUID ***。Did this is related to network?

Add a Comment

It seems that after Xcode 15, you need to debug in a different way. Here are the steps:

  1. Add a breakpoint in the extension code.
  2. Run the app (not extension).
  3. Navigate to "Debug", then select "Attach Process by PID or Name"
  4. Enter your extension target's name (e.g., BackgroundDownloadExtension) in the input field.
  5. Open the Terminal app.
  6. Enter the command like this: xcrun backgroundassets-debug --app-bundle-id [com....] --device-id [3...f] --simulate --app-update and click "Attach".
  7. Breakpoint entered!
  • step6: and click "Attach". should in step4

Add a Comment