Skip to content

iOS: incompatible with Flutter's new UISceneDelegate embedding (FlutterSceneDelegate + implicit engine) #109

Description

@shahmirzali49

Summary

flutter_carplay 1.3.3's required iOS setup — a manually-created shared FlutterEngine
plus a classic SceneDelegate — is incompatible with apps that have adopted Flutter's
new UISceneDelegate lifecycle (FlutterSceneDelegate + FlutterImplicitEngineDelegate).
Adopting flutter_carplay forces a revert to the legacy engine/scene pattern, which breaks
features that depend on the implicit engine (e.g. plugin registration / background isolates
used for notification taps when the app is terminated).

Environment

  • flutter_carplay: 1.3.3
  • Flutter: 3.35+ (UISceneDelegate migration adopted)
  • Platform: iOS / CarPlay

Current required setup (legacy)

The README requires:

  • A global, manually-created engine:
    let flutterEngine = FlutterEngine(name: "SharedEngine", project: nil, allowHeadlessExecution: true)
    run inside application(_:didFinishLaunchingWithOptions:).
  • A classic SceneDelegate.swift conforming to UIWindowSceneDelegate.
  • Info.plist UIWindowSceneSessionRoleApplication → that custom SceneDelegate, plus
    CPTemplateApplicationSceneSessionRoleApplicationflutter_carplay.FlutterCarPlaySceneDelegate.

New Flutter embedding (what recent Flutter generates / recommends)

  • AppDelegate adopts FlutterImplicitEngineDelegate and implements
    didInitializeImplicitFlutterEngine(_:); plugins register on the implicit engine via
    engineBridge.pluginRegistry. No engine is created manually.
  • Info.plist UIWindowSceneSessionRoleApplicationUISceneDelegateClassName = FlutterSceneDelegate.
  • Ref: https://docs.flutter.dev/release/breaking-changes/uiscenedelegate

The conflict

There is no documented way to use flutter_carplay alongside FlutterSceneDelegate / the
implicit engine. Satisfying flutter_carplay requires replacing FlutterSceneDelegate with a
custom SceneDelegate and abandoning the implicit engine for a manual shared engine. That
revert breaks apps relying on the implicit engine — in our case the background isolate wired
through didInitializeImplicitFlutterEngine for notification taps after termination.

Request

Please support the new UIScene embedding:

  • Let FlutterCarPlaySceneDelegate attach to the implicit engine (or an app-provided
    engine / binaryMessenger) instead of requiring a hard-coded global SharedEngine.
  • Let the phone scene keep using FlutterSceneDelegate.
  • Document a setup path for apps that have adopted the UISceneDelegate migration.

Workaround

For now we implemented CarPlay natively (a CPTemplateApplicationSceneDelegate scene bridging
to Dart over a MethodChannel), which leaves the new embedding untouched. First-class
flutter_carplay support for the implicit engine would be much nicer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhanceEnhancement of an existing feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions