0

I have a main project with some local packages. These packages are imported in the main project as features. I want to have an Analytics package that is a simple wrapper around Firebase Analytics that can be imported in some of those packages. The main target also has the Firebase Analytics package for legacy reasons.

I can import the package in my main project.

Somehow, I can build the project, but it fails to build for testing when the Analytics package is imported in other packages. Its giving errors like: Undefined symbol: _GULIsLoggableLevel.

I've tried to set the linkerFlag -ObjC on the package already, doesn't make a difference. What's going wrong? Do I need to change something in my test target of the main project?

This is my Package.swift:

// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Analytics",
    platforms: [.iOS(.v16), .macCatalyst(.v15)],
    products: [
        .library(
            name: "Analytics",
            targets: ["Analytics"])
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/firebase/firebase-ios-sdk.git", from: "11.12.0")
    ],
    targets: [
        .target(
            name: "Analytics",
            dependencies: [
                .product(name: "FirebaseAnalytics", package: "firebase-ios-sdk")
            ]),
        .testTarget(
            name: "AnalyticsTests",
            dependencies: ["Analytics"])
    ]
)
2
  • Does main target have same 11.12.0 version? Commented May 27 at 16:01
  • Yes, both have the same version. Commented May 27 at 23:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.