Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such module 'Firebase' - Xcode and Swift Package Manager

I'm trying to incorporate Firebase Analytics into my SwiftUI project in Xcode. I've added the Firebase package using Swift Package Manager, and am able to call FirebaseApp.configure() to initialize my app in my UIApplicationDelegate class. Now I'm trying to log analytics events and am running into an issue.

My UIApplicationDelegate class is in an iOS-specific folder. I have a service class that is in a Shared folder (to be used across both iOS and macOS builds). In my service class, I've added a line that says:

import Firebase

However, when I go to build my iOS target I get an error saying:

No such module 'Firebase'

I don't know why this import statement would cause a problem, since I have the very same statement in my UIApplicationDelegate class. The only thing I could think of was that somehow my Shared classes don't know about Firebase? Maybe? When I view the iOS target in my project it shows that the FirebaseCrashlytics and FirebaseAnalytics frameworks have been added to it.

I'm at a loss as to what's happening. All other things I've found online are for Cocoapods, which I'm not using for dependency management. I'm leveraging the Swift Package Manager for this. Any help would be greatly appreciated!!

like image 329
Shadowman Avatar asked Dec 28 '25 14:12

Shadowman


2 Answers

After installing the Firebase swift package, make sure you add the Firebase libraries to Frameworks:

TARGETS -> Your App -> General -> Frameworks, Libraries, and Embedded Content -> hit '+' to add the Firebase libraries you want:

enter image description here

like image 184
fullmoon Avatar answered Dec 30 '25 05:12

fullmoon


I had the same issue but the post below from GitHub should fix it:

https://github.com/firebase/firebase-ios-sdk/issues/9014#issuecomment-979489434

like image 45
Simon9987 Avatar answered Dec 30 '25 03:12

Simon9987



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!