I'm using Firebase in my iOS project. In my AppDelegate, I have the following:
final class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
FirebaseApp.configure()
return true
}
}
In my project's target settings:
Under Link Binary With Libraries, I have added FirebaseFirestore
and FirebaseCore
.
Under Frameworks, Libraries, and Embedded Content, I also see FirebaseFirestore
and FirebaseCore
.
Everything related to Firebase was working before I added Firestore.
I tried adding the Firebase Swift Package with different dependency rules:
.upToNextMajor(from: "11.11.0") (i.e., 11.11.0 ..< 12.0.0)
.upToNextMajor(from: "12.1.0") (i.e., 12.1.0 ..< 13.0.0)
But neither rule worked (I also deleted Derived Data and quit Xcode each time) and I keep getting the same error from a title.
What is the issue here?
EDIT:
This is how package dependencies look like:
If it matters, I am using Xcode Version 16.4 (16F6)
EDIT2:
I tried it on an empty project, and compiles normally. If there is some more info I could add, please let me know...
So the first thing I didn't mention is that I am using Firebase Firestore inside my local package (sorry about that). I'm adding Firebase as a dependency to my local package through the Package.swift
manifest, rather than installing it through Xcode.
In this situation, as per docs we should first add Firebase to the dependencies array:
dependencies: [
.package(
name: "Firebase",
url: "https://github.com/firebase/firebase-ios-sdk.git",
.upToNextMajor(from: "10.4.0")
),
// Any other dependencies you have...
]
after that, in any target that depends on a Firebase product, add it to the dependencies
array of that target (which was my main issue):
.target(
name: "MyTargetName",
dependencies: [
// The product(s) you want (e.g. FirebaseAuth).
.product(name: "FirebaseAuth", package: "Firebase"),
]
),