fix(flutter): name the iOS podspec after the pub package (pulsar_haptics) - #141
Draft
ilya-clicapin wants to merge 1 commit into
Draft
Conversation
Flutter derives the expected podspec path from the pub package name, so it looked for `ios/pulsar_haptics.podspec`, did not find it, and — because `ios/pulsar_haptics/Package.swift` is present — concluded the plugin is Swift Package Manager only. In an app that uses CocoaPods, `flutter pub get` then failed with "Plugin pulsar_haptics is only compatible with Swift Package Manager" and the plugin could not be adopted at all. The same name drives the module `GeneratedPluginRegistrant` imports (`@import pulsar_haptics;`), so even with SPM disabled by hand the pod built under the wrong module name. Rename `ios/pulsar.podspec` to `ios/pulsar_haptics.podspec`, set `s.name` to match, and tag `s.version` with a `pulsar-sync:flutter-version` marker so `scripts/sync-sdk-versions.mjs` keeps it in step with the pub version instead of leaving it stuck at 0.0.1. CocoaPods compares product module names case-insensitively, so the plugin pod `pulsar_haptics` now collides with the native pod's derived module `Pulsar_haptics` (from `Pulsar-haptics`) whenever the app opts into frameworks. The example app's Podfile drops `use_frameworks!` for that reason; declaring `s.module_name = 'Pulsar'` on the native podspec — matching the module name its Swift Package already exposes — would lift the restriction for apps that need frameworks, but that needs a native release and is left out here. Verified on the example app with Flutter 3.44.0: with SPM disabled, `flutter pub get` and `pod install` succeed and `flutter build ios --debug --simulator` builds; with SPM enabled, the build still succeeds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ilya-clicapin
force-pushed
the
fix/flutter-cocoapods-podspec-name
branch
from
July 29, 2026 15:45
9d2b015 to
a488f54
Compare
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.
Fixes #140.
What was broken
Flutter derives the expected podspec filename from the pub package name, so it looked for
flutter/pulsar/ios/pulsar_haptics.podspec. The file was namedpulsar.podspec, and becauseios/pulsar_haptics/Package.swiftis present the tooling concluded the plugin is Swift Package Manager only. In an app that uses CocoaPods,flutter pub getends with:The pub name also drives the module
GeneratedPluginRegistrantimports (@import pulsar_haptics;), so even forcing the pod in by hand would have built it under the wrong module name.Changes
flutter/pulsar/ios/pulsar.podspectoios/pulsar_haptics.podspecand sets.name = 'pulsar_haptics'.s.versionwith apulsar-sync:flutter-versionmarker soscripts/sync-sdk-versions.mjskeeps it in step with the pub version — it was stuck at0.0.1while the package is at0.0.3.scripts/sync-sdk-versions.mjsat the new filename (it would otherwise throw on the old path).pulsarfromCONTRIBUTING.mdand from the SPM comment in_build-ios-flutter.yml(that workflow's symlink dance is unchanged — the mirror is nowpulsar_haptics, but routing through a uniquely-named symlink still costs nothing).ios/Podfile.lock, and dropuse_frameworks!— see below.The
use_frameworks!caveatCocoaPods' target validator compares product module names case-insensitively, so the plugin pod
pulsar_hapticscollides with the module CocoaPods derives for the native podPulsar-haptics(Pulsar_haptics):This only triggers when the app opts into frameworks; with the default static linkage
pod installis fine. That's why the example app's Podfile dropsuse_frameworks!, with a comment pointing here.The real fix is
s.module_name = 'Pulsar'oniOS/Pulsar/Pulsar-haptics.podspec— that is the module name the Swift Package already exposes, and the Flutter bridge's#if canImport(Pulsar_haptics)/#elseif canImport(Pulsar)shim already accepts both — but it only takes effect once a native pod carrying it is published, so I left it out. Happy to fold it in if you'd rather ship both together.Verification
Flutter 3.44.0, Xcode 26.5, CocoaPods 1.16.2, on
flutter/PulsarApp.With SPM disabled (
flutter config --no-enable-swift-package-manager), which is the configuration from the issue:flutter pub get— succeeds (fails onmainwith the error above)pod install— installsFlutter,Pulsar-haptics (1.1.2),pulsar_haptics (0.0.3)flutter build ios --debug --no-codesign --simulator— buildsWith SPM enabled,
flutter build ios --debug --no-codesign --simulatorstill builds, so the CI path in_build-ios-flutter.ymlis unaffected.node scripts/sync-sdk-versions.mjsruns clean and leaves the tree unchanged.Not included
The CI guard suggested in the issue. The Flutter iOS job in
test-build-apps.ymlisworkflow_dispatch-only and goes through SPM, so adding a CocoaPods cell (SPM off,pub get+pod install) is a dispatcher-shape decision I'd rather leave to you — say the word and I'll add it here.Unrelated drift I noticed while in here: the Flutter plugin pins
Pulsar-hapticsat1.1.2whilesdk-versions.jsonlists iOS1.2.0. Left untouched.