-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Description
I’m trying to reuse Firebase Authentication inside an iOS share extension. The host app builds fine, but as soon as I add pod 'FirebaseAuth' to the share-extension target and import it from Swift, the extension target fails to compile. Xcode errors all point into the generated FirebaseAuth-Swift.h:
FirebaseAuth-Swift.h:72:9: No type or protocol named 'FIRComponentLifecycleMaintainer'
FirebaseAuth-Swift.h:210:16: No type or protocol named 'SFSafariViewControllerDelegate'
FirebaseAuth-Swift.h:211:16: Cannot find protocol declaration for 'WKNavigationActionDelegate'; did you mean 'UINavigationBarDelegate'?
FirebaseAuth-Swift.h:213:12: Unknown type name 'WKNavigationActionPolicy'; did you mean 'WKNavigationAction'?
It looks as if the Swift header that ships with FirebaseAuth assumes that FirebaseCoreExtension/FIRComponent.h, SafariServices, and WebKit have already been imported, but that’s not the case in a fresh share-extension target. The result is that we can’t compile the extension at all, even though FirebaseAuth is linked.
Expected: importing FirebaseAuth in an extension should just work, or the module should re-export the headers it needs.
Actual: the build fails in FirebaseAuth-Swift.h because dependencies are missing.
Reproducing the issue
Create a basic iOS app project and add a Share Extension target.
Use CocoaPods with static frameworks (our Podfile contains use_frameworks! :linkage => :static because we’re on React Native).
In the share-extension target block add:
pod 'FirebaseCore'
pod 'FirebaseCoreExtension'
pod 'FirebaseAuth'
Run pod install, open the workspace, build the share-extension target.
Observe the compiler errors listed above coming from FirebaseAuth-Swift.h.
If you add the bridging header shown earlier, the extension builds — but that shouldn’t be necessary; the module should bring in its own dependencies.
Firebase SDK Version
12.1.0
Xcode Version
16.0
Installation Method
CocoaPods
Firebase Product(s)
Authentication
Targeted Platforms
iOS
Relevant Log Output
FirebaseAuth-Swift.h:72:9: No type or protocol named 'FIRComponentLifecycleMaintainer'
FirebaseAuth-Swift.h:210:16: No type or protocol named 'SFSafariViewControllerDelegate'
FirebaseAuth-Swift.h:211:16: Cannot find protocol declaration for 'WKNavigationActionDelegate'; did you mean 'UINavigationBarDelegate'?
FirebaseAuth-Swift.h:213:12: Unknown type name 'WKNavigationActionPolicy'; did you mean 'WKNavigationAction'?If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.