fix(ios): include the Obj-C shim in the podspec source_files - #397
Open
bohdanvela wants to merge 2 commits into
Open
fix(ios): include the Obj-C shim in the podspec source_files#397bohdanvela wants to merge 2 commits into
bohdanvela wants to merge 2 commits into
Conversation
The shim added in 11.0.2 is never compiled under CocoaPods, so 11.0.2 still fails exactly like 11.0.1 (Dev-hwang#395, Dev-hwang#396): Semantic Issue (Xcode): Unknown receiver 'FlutterForegroundTaskPlugin'; did you mean 'SwiftFlutterForegroundTaskPlugin'? ios/Runner/GeneratedPluginRegistrant.m Both globs in source_files are resolved relative to the podspec's directory (ios/). The Swift glob carries the `flutter_foreground_task/` prefix, but the Obj-C one does not, so CocoaPods looks for ios/Classes/ while the files actually live in ios/flutter_foreground_task/Classes/. The glob matches nothing and the shim is silently dropped from the pod. Add the missing prefix so the shim is compiled. Verified on a CocoaPods (non-SPM) app, clean Pods/ and build/ each time, changing only this glob: before -> Unknown receiver ...; 0 references to FlutterForegroundTaskPlugin.m in the generated Pods.xcodeproj after -> builds and links; 4 references
Author
|
@Dev-hwang please take a look, it should fix these issues |
Author
|
I had the same problem and when I tried to clean the cache, the error persisted |
Ship the podspec fix so CocoaPods users are unblocked; 11.0.2 still fails with "Unknown receiver 'FlutterForegroundTaskPlugin'" because the shim it added never reaches the pod.
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.
Problem
The Obj-C shim added in 11.0.2 is never compiled under CocoaPods, so 11.0.2 still fails exactly like 11.0.1 for non-SPM apps (#395, #396):
Cause
Both globs in
source_filesare resolved relative to the podspec's directory (ios/). The Swift glob carries theflutter_foreground_task/prefix, but the Obj-C one does not:So CocoaPods looks for
ios/Classes/, while the files actually live inios/flutter_foreground_task/Classes/. The glob matches nothing, the shim is silently dropped from the pod, andFlutterForegroundTaskPluginnever exists for the generated registrant — the class is otherwise only declared inFlutterForegroundTaskPluginSPMBridge.swiftbehind#if SWIFT_PACKAGE, which is not defined for CocoaPods builds.Fix
Add the missing prefix so the shim is part of the pod.
Verification
Built a real CocoaPods (non-SPM) app against this repo, wiping
Pods/andbuild/before each run and changing only this glob:source_filesObj-C globFlutterForegroundTaskPlugin.mrefs in generatedPods.xcodeproj'Classes/**/*.{h,m}'(11.0.2 as published)Unknown receiver 'FlutterForegroundTaskPlugin''flutter_foreground_task/Classes/**/*.{h,m}'(this PR)Environment: Flutter 3.47.2, CocoaPods 1.16.2, Xcode iOS device release build, SPM disabled (
flutter config --no-enable-swift-package-manager).Closes #395
Closes #396