fix(ios): forward all background URL session events to the SDK per docs#6
Merged
Merged
Conversation
The identifier-routing added in 0.2.0 (handlesBackgroundURLSession prefix check, with non-matching sessions going to super / completionHandler()) deviated from the MotionTag iOS guide. The guide and the official Flutter SDK's AppDelegate forward every identifier unconditionally - the SDK decides internally which sessions are its own and only calls the completion handler for those (verified against the SDK 6.5.0 binary: registerCallback ignores foreign identifiers' handlers rather than completing them). The prefix check was also fragile: a future SDK version changing its session identifier would silently break background upload recovery again. Removes MotionTagBootstrap.handlesBackgroundURLSession (added in 0.2.0, consumed only by plugin-generated code; re-run expo prebuild after updating). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The background URL session handling added in 0.2.0 (#2) used an identifier-prefix check (
handlesBackgroundURLSession) to route only MotionTag-owned sessions to the SDK. That is not what the MotionTag iOS guide prescribes, and not what MotionTag's official Flutter SDK AppDelegate does:Every identifier is forwarded unconditionally — the SDK decides internally which sessions are its own. Verified against the SDK 6.5.0 binary:
registerCallback:forIdentifier:stores the handler and only invokes it when the SDK's own session finishes events, so foreign handlers go stale rather than being double-called.The prefix check was also fragile: a future SDK version changing its session identifier would silently break background-upload recovery again.
What
plugin/withIosAppDelegate.js: generated override is now a plain unconditional forward (matches the Flutter reference; existing misplaced/old blocks are replaced onexpo prebuild)ios/MotionTagBootstrap.swift: removedhandlesBackgroundURLSession(identifier:)README.md: bare-RN snippet reverted to the docs pattern; identifier-prefix maintenance note dropped from the SDK-bump checklistNote for consumers
handlesBackgroundURLSessionexisted only in 0.2.0/0.3.0 (released today) and is consumed only by plugin-generated code — re-runnpx expo prebuildafter updating and the reference disappears. Bare-RN hosts following the old README snippet should simplify to the unconditional forward.Verification
expo prebuildregenerates the example AppDelegate with the docs-exact override; old generated blocks are migrated🤖 Generated with Claude Code