fix(ios): answer scene configuration for the requested session role - #1305
Open
rubenmuehlhans wants to merge 1 commit into
Open
rubenmuehlhans wants to merge 1 commit into
rubenmuehlhans wants to merge 1 commit into
Conversation
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.
What
On iOS,
application:configurationForConnectingSceneSession:options:always answers with aUIWindowSceneSessionRoleApplicationconfiguration — theconnecting_scene_sessionparameter isunused, so the role the system is asking about is never read.
That method takes precedence over the app's
UIApplicationSceneManifest. So when the system asksabout a non-window role, it gets a window configuration back and the scene never connects. The
app's manifest is correct, the delegate is registered, and nothing is logged — the scene simply
does not appear.
This affects any tao app that declares a second scene role. In our case that is CarPlay: the app
is entitled, the manifest declares a
CPTemplateApplicationSceneSessionRoleApplicationconfiguration, and the app still does not show up on the CarPlay home screen. External displays
(
UIWindowSceneSessionRoleExternalDisplayNonInteractive) are the same shape of problem.How
Read the role from the connecting session and branch on it:
nil) — unchanged: theTaoSceneconfiguration withTaoSceneDelegate.nilas the name, which selects the firstconfiguration the app's manifest declares for that role. tao therefore needs to know nothing
about how the app named its scenes, and does not need a list of roles it supports.
The
nil-name behaviour is documented underUISceneConfiguration(name:sessionRole:).No API change, no new dependency, no behaviour change for apps without a scene manifest.
Testing
connects in the simulator and the app appears on the CarPlay home screen; the phone window is
unaffected. Also verified on device (iPhone 15 Pro, iOS 26.6) that the normal window path still
launches.
cargo testpasses;cargo check --target aarch64-apple-iosis clean on this branch.Note for the 0.35 line
While tracking this down we hit a second, separate bug that is already fixed on
dev: 0.35.3returns the configuration with
Retained::as_ptr(&config), which releases the object before UIKitretains it. It is harmless as long as no app declares a scene manifest, because iOS then never
calls this method at all — but with a manifest it is a hard
EXC_BAD_ACCESSinobjc_retainfrom-[UIApplication _connectUISceneFromFBSScene:transitionContext:], on device,about 70 ms into launch.
devalready usesautorelease_ptr, so nothing to do here; mentioning itonly in case a 0.35 patch release is ever considered, since the two bugs meet in exactly the same
place.