Skip to content

🚀 [firebase_analytics] Swift Package Manager needs to have a way to use FirebaseAnalyticsWithoutAdIdSupport #17958

@inceptusp

Description

@inceptusp

There is no way to replace the SPM dependency for FirebaseAnalytics with FirebaseAnalyticsWithoutAdIdSupport as the first is added automatically by SPM because firebase_analytics describes that it depends on FirebaseAnalytics...

let package = Package(
  name: "firebase_analytics",
  platforms: [
    .iOS("15.0"),
  ],
  products: [
    .library(name: "firebase-analytics", targets: ["firebase_analytics"]),
  ],
  dependencies: [
    .package(url: "https://github.com/firebase/firebase-ios-sdk", from: firebase_sdk_version),
    .package(url: "https://github.com/firebase/flutterfire", exact: shared_spm_version),
  ],
  targets: [
    .target(
      name: "firebase_analytics",
      dependencies: [
        .product(name: "FirebaseAnalytics", package: "firebase-ios-sdk"),                            <====
        // Wrapper dependency
        .product(name: "firebase-core-shared", package: "flutterfire"),
      ],
      resources: [
        .process("Resources"),
      ]
    ),
  ]
)

The native docs states that we should add the FirebaseAnalyticsWithoutAdIdSupport instead of the other one, but that is not how we do native deps in flutter... the package selects the native dependency...

I was migrating my project to SPM when stumbled on this, because it uses AnalyticsWithoutAdIdSupport... 😕
Until now, I was using cocoapods and the old documented way to change the platform dependency to FirebaseAnalyticsWithoutAdIdSupport...

Image

But with SPM I am not seeing a way to do it.....

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions