Skip to content

feat: add iOS UIScene life cycle support - #220

Merged
MichaelGHSeg merged 2 commits into
mainfrom
feat/add-UIScene-life-cycle
Oct 16, 2026
Merged

MichaelGHSeg merged 2 commits into
mainfrom
feat/add-UIScene-life-cycle

Conversation

@sunitaprajapati89

Copy link
Copy Markdown
Contributor

Summary

Fixes #192. Flutter and Apple are moving iOS apps to the UIScene life cycle. In a UIScene app, UIKit no longer calls application(_:open:options:), so the core plugin's deep link tracking (trackDeeplinks) would silently stop receiving URLs.

  • AnalyticsPlugin now also conforms to FlutterSceneLifeCycleDelegate, registers with registrar.addSceneDelegate, and handles scene(_:openURLContexts:). Flutter forwards both warm URLs and the cold-start launch URL there.
  • The existing UIApplicationDelegate path is kept for apps that have not migrated; both paths share one handleDeeplink helper.
  • The example app is migrated to UIScene (AppDelegate with FlutterImplicitEngineDelegate, new SceneDelegate, scene manifest in Info.plist) and registers a segmentexample:// URL scheme for testing deep links.
  • segment_analytics bumped to 1.2.0, minimum Flutter raised to 3.38.0.

Breaking change / compatibility

addSceneDelegate: and FlutterSceneLifeCycleDelegate only exist from Flutter 3.38.0. Apps on older Flutter should stay on segment_analytics 1.1.12. This is noted in the CHANGELOG and README.

Testing

iOS 18.3 simulator (iPhone 16), using xcrun simctl openurl and a temporary log in the handler (not included). Each URL was delivered exactly once.

App type Flutter Cold start Warm
UIScene 3.44.9 ✓ ✓
UIScene 3.38.0 ✓ ✓
Non-scene (original example) 3.38.0 ✓ ✓

Not tested: non-scene app on 3.44.9, physical devices, universal links, and the Deep Link Opened event payload on the Dart side.

An early version also handled willConnectTo, which delivered the cold-start URL twice; that handler was removed.

Known unrelated issue

14 Dart test files in packages/core fail to compile on Flutter 3.38.0 (67 pass). They fail identically on a clean checkout of main: the generated test/mocks/mocks.mocks.dart is out of date against newer Flutter framework classes. Not addressed here.

🤖 Generated with Claude Code

Sunita Prajapati and others added 2 commits October 13, 2026 11:39
Register the core plugin as a scene delegate so deep links are received
via scene(_:openURLContexts:) in apps that adopt the UIScene life cycle.
The UIApplicationDelegate path is kept for apps that have not migrated.

- Require Flutter >=3.38.0 (first release with the scene plugin API)
- Bump segment_analytics to 1.2.0
- Migrate the example app to UIScene

Fixes #192

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Resolve CHANGELOG/pubspec conflicts: keep 1.2.0 above main's 1.1.13
- Bump segmentVersion in lib/version.dart to 1.2.0
- Point older-Flutter users at 1.1.13 (latest release without the 3.38 floor)
- Raise the pinned CI/publish Flutter SDK from 3.29.2 to 3.38.0 (new sha256)
  to satisfy the new minimum Flutter version
- Regenerate test mocks (stale against Flutter 3.38 framework classes) and
  exclude the generated file from analysis

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@MichaelGHSeg
MichaelGHSeg merged commit b275e67 into main Oct 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UIScene life cycle support

2 participants