Skip to content

fix: example iOS SPM build and apply Flutter 3.44 example migrations - #127

Merged
muzahidul-opti merged 3 commits into
masterfrom
fix/example-ios-spm-override
Oct 16, 2026
Merged

muzahidul-opti merged 3 commits into
masterfrom
fix/example-ios-spm-override

Conversation

@muzahidul-opti

@muzahidul-opti muzahidul-opti commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

 example/ios/Runner.xcodeproj  Flutter group
-  optimizely_flutter_sdk -> ../../ios/optimizely_flutter_sdk   # folder ref (added in #116)
   FlutterFramework
   FlutterGeneratedPluginSwiftPackage

Xcode treats a package folder added to a project as a local override, and it uses the folder name as the package identity (optimizely_flutter_sdk). Flutter's generated plugin package points at the same package through a symlink named optimizely-flutter-sdk. SPM won't let one package have two identities:

unable to override package 'optimizely_flutter_sdk' because its identity
'optimizely-flutter-sdk' doesn't match override's identity (directory name) 'optimizely_flutter_sdk'

Also commits the project migrations Flutter 3.44 applies on every flutter build/analyze. Without them, every build leaves the example with uncommitted changes:

 example/ios/Runner/AppDelegate.swift
-  class AppDelegate: FlutterAppDelegate
-    GeneratedPluginRegistrant.register(with: self)
+  class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate
+    didInitializeImplicitFlutterEngine → GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
 example/ios/Runner/Info.plist
+  UIApplicationSceneManifest → FlutterSceneDelegate (UIScene lifecycle)
 example/analysis_options.yaml
+  analyzer.exclude: build/, android/, ios/, web/, windows/, macos/, linux/

Removing the folder reference leaves Flutter's generated package as the only reference to the plugin. You can still browse and edit the plugin sources through that package in Xcode.

Evidence

  • Before (master, checkout folder optimizely-flutter-sdk): cd example && flutter build ios --simulator --no-codesign → exit 1, the identity error above.
    After (this branch, same folder name): ✓ Built build/ios/iphonesimulator/Runner.app → exit 0.
  • Migrations: before, flutter build ios left 3 modified files. After, rebuilding leaves git status clean, and the build still passes.
  • cd example && flutter analyze: 85 issues both before and after. All are existing prefer_const_constructors-style info lints, and none come from this PR.

Merge Danger

Door: two-way. Revert the two removed lines.
Blast Radius: example app only. The UIScene migration changes how the example registers plugins, following Flutter's own template. It isn't part of the pub.dev package, and CI doesn't build it. No effect on SDK consumers.

🤖 Generated with Claude Code

muzahidul-opti and others added 2 commits October 16, 2026 10:24
Runner.xcodeproj referenced ios/optimizely_flutter_sdk as a folder, which
Xcode treats as a local package override with identity
'optimizely_flutter_sdk'. Flutter's generated plugin package references the
same package via a symlink named 'optimizely-flutter-sdk', and SPM refuses
the mismatched identities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commit the project migrations Flutter applies on every build/analyze so the
example no longer leaves a dirty working tree:
- AppDelegate: register plugins via FlutterImplicitEngineDelegate (UIScene)
- Info.plist: UIApplicationSceneManifest with FlutterSceneDelegate
- analysis_options.yaml: exclude platform/build dirs from the analyzer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@muzahidul-opti muzahidul-opti changed the title fix: example iOS build fails with SPM package identity mismatch fix: example iOS SPM build and apply Flutter 3.44 example migrations Oct 16, 2026
@muzahidul-opti
muzahidul-opti merged commit 6dd3ed3 into master Oct 16, 2026
7 of 9 checks passed
@muzahidul-opti
muzahidul-opti deleted the fix/example-ios-spm-override branch October 16, 2026 14:41
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.

1 participant