MobileNativeFoundation / MobileNativeFoundation/rules_xcodeproj

Bug: Unable to debug BGTaskScheduler with BwB

Open
#2,397 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug BwB
Dominant language
Swift
Stars
626
Forks
124
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/MobileNativeFoundation/rules_xcodeproj/discussions/2391

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal BGTaskScheduler reproduction described in the issue and compare the projects generated by BwX and BwB. Follow Apple's LLDB simulation command for each generated project; done means the scheduled task reaches its breakpoint in BwB as it does in BwX.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.