Description
After migrating our Flutter iOS app to the UIScene lifecycle, Mobile GTM Preview no longer works on cold start.
The preview URL is correctly delivered to:
scene(_:willConnectTo:options:)
and exists in connectionOptions.urlContexts.
We forward it using the documented API:
Analytics.handleOpen(context.url)
GTM logs that it processed the URL, but it still loads the saved container instead of the preview container.
GoogleTagManager info: Loading container: GTM-XXXX
GoogleTagManager info: Attempting to load saved version of container GTM-XXXX
GoogleTagManager info: processing URL: tagmanager.c.<bundle-id>://preview/...
GoogleTagManager info: Attempting to load preview container for GTM-XXXX
Workaround
Calling the private API +[TAGContainerLoader processURL:] before GTM container initialization makes the preview container load correctly.
We do not want to depend on this private API.
Environment
GoogleTagManager: 9.2.0
FirebaseAnalytics / GoogleAppMeasurement: 12.9.0
Flutter: 3.41.4
Xcode: 16.4
iOS: 18.5
Lifecycle: UIScene
Flutter integration details:
- AppDelegate subclasses FlutterAppDelegate and implements FlutterImplicitEngineDelegate.
- SceneDelegate subclasses FlutterSceneDelegate.
- UIApplicationSceneManifest in Info.plist explicitly specifies the app's SceneDelegate, which subclasses FlutterSceneDelegate.
- Flutter plugins are registered through GeneratedPluginRegistrant in didInitializeImplicitFlutterEngine(_:).
- Firebase is initialized from Dart using FlutterFire:
Question
What is the supported public way to process a Mobile GTM preview URL before container loading during a UIScene cold start?
Description
After migrating our Flutter iOS app to the UIScene lifecycle, Mobile GTM Preview no longer works on cold start.
The preview URL is correctly delivered to:
and exists in connectionOptions.urlContexts.
We forward it using the documented API:
Analytics.handleOpen(context.url)
GTM logs that it processed the URL, but it still loads the saved container instead of the preview container.
Workaround
Calling the private API +[TAGContainerLoader processURL:] before GTM container initialization makes the preview container load correctly.
We do not want to depend on this private API.
Environment
GoogleTagManager: 9.2.0
FirebaseAnalytics / GoogleAppMeasurement: 12.9.0
Flutter: 3.41.4
Xcode: 16.4
iOS: 18.5
Lifecycle: UIScene
Flutter integration details:
Question
What is the supported public way to process a Mobile GTM preview URL before container loading during a UIScene cold start?