Skip to content

Bug: Unable to debug BGTaskScheduler with BwB  #2397

Open
@erikkerber

Description

@erikkerber

Description

Apple provides private APIs to assist with debugging scheduled background tasks during development:

Starting and Terminating Tasks During Development

In our project, this technique works when generating via BwX but not when generating via BwB.

Reproduction steps

  1. Create an app leveraging BGTaskScheduler
  2. Follow the debug instructions as provided by Apple:

To launch a task:

Set a breakpoint in the code that executes after a successful call to submit(_:).

Run your app on a device until the breakpoint pauses your app.

In the debugger, execute the line shown below, substituting the identifier of the desired task for TASK_IDENTIFIER.

Resume your app. The system calls the launch handler for the desired task.

e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"TASK_IDENTIFIER"]
  1. Repeat for BwX (works), BwB (does not work)

Expected behavior

Scheduled tasks result in a breakpoint being triggered in BwB

rules_xcodeproj version

1.7.0

Xcode version

14.3

Bazel version

6.2

rules_apple version

No response

rules_swift version

No response

Additional information

This is a note I've had for a few months, but it was only needed in the moment which had passed and I didn't want to write up an issue without a minimal repro.

I'm writing this up now to track and link to for #2391

Metadata

Metadata

Assignees

No one assigned

    Labels

    BwBRelated to Build with Bazel modebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions