firebase-ios-sdk
firebase-ios-sdk copied to clipboard
Unit test - _OBJC_CLASS_$_FIRAnalytics symbol(s) not found for architecture x86_64
Description
I have SPM package with FirebaseAnalytics dependency which is added to app and to other packages which contains unit tests too.
Below my Package.swift of my SPM package.
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "AppAnalytics",
platforms: [.iOS("14.0")],
products: [
.library(
name: "AppAnalytics",
targets: ["AppAnalytics"]),
.library(
name: "AppAnalyticsMocks",
targets: ["AppAnalyticsMocks"])
],
dependencies: [
.package(path: "../Core"),
.package(path: "../Networking"),
.package(path: "../PUC"),
.package(url: "https://github.com/firebase/firebase-ios-sdk.git", exact: Version(10, 7, 0)),
.package(url: "https://github.com/Quick/Quick", exact: Version(5, 0, 1)),
.package(url: "https://github.com/Quick/Nimble", exact: Version(10, 0, 0))
],
targets: [
.target(
name: "AppAnalytics",
dependencies: ["Core",
"Networking",
"PUC",
.product(name: "FirebaseAnalytics", package: "firebase-ios-sdk"),
.product(name: "FirebasePerformance", package: "firebase-ios-sdk")]),
.target(
name: "AppAnalyticsMocks",
dependencies: ["AppAnalytics"],
path: "Mocks"),
.testTarget(
name: "AppAnalyticsTests",
dependencies: ["AppAnalytics",
"AppAnalyticsMocks",
"Quick",
"Nimble"])
]
)
And when I build app there is no problem, but when I'm building unit test I have error
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FIRAnalytics", referenced from:
objc-class-ref in AppAnalytics.o
ld: symbol(s) not found for architecture x86_64
Reproducing the issue
No response
Firebase SDK Version
10.7.0
Xcode Version
14.2
Installation Method
Swift Package Manager
Firebase Product(s)
Analytics
Targeted Platforms
iOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Marking for Firebase 11 to see if it gets addressed by dynamic libraries
Hi @piotrsmajek, is this still an issue on Xcode 15? Xcode 15 introduced a new linker. If it still does not work, does adding .product(name: "FirebaseAnalytics", package: "firebase-ios-sdk" as a dependency of the AppAnalyticsTests target fix the undefined symbol error?
Hey @piotrsmajek. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@piotrsmajek if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.