无法解析清单文件,在我的Xcode Swift Package Manger中

agxfikkp  于 2023-06-24  发布在  Swift
关注(0)|答案(1)|浏览(113)

通过Swift Package Manager安装Firebase。我尝试使用Swift包管理器从Github仓库自动安装这个库。当我构建项目时,我收到了一个错误,说“未能解析清单文件”。swift包文件在我的项目的“firebase-ios-sdk-master”子目录中。
下面是我的Package.swift文件:

import PackageDescription
import class Foundation.ProcessInfo

let firebaseVersion = "9.3.0"

let package = Package(
  name: "Firebase",
  platforms: [.iOS(.v11), .macOS(.v10_12), .tvOS(.v12), .watchOS(.v7)],
  products: [
    .library(
      name: "FirebaseAnalytics",
      targets: ["FirebaseAnalyticsTarget"]
    ),
 //...
  ],
  dependencies: [
    .package(name: "Firebase",
               url: "https://github.com/firebase/firebase-ios-sdk.git",
               from: "8.0"
    ),
    .package(
      name: "Promises",
      url: "https://github.com/google/promises.git",
      "2.1.0" ..< "3.0.0"
    ),
//...
  ],
  targets: [
    .target(
      name: "Firebase",
      dependencies: [
        .product(name: "FirebaseAuth", package: "Firebase"),
      ],
      path: "CoreOnly/Sources",
      publicHeadersPath: "./"
    ),
    .target(
      name: "FirebaseCore",
      dependencies: [
        "Firebase",
        "FirebaseCoreDiagnostics",
        "FirebaseCoreInternal",
        .product(name: "GULEnvironment", package: "GoogleUtilities"),
        .product(name: "GULLogger", package: "GoogleUtilities"),
      ],
      path: "FirebaseCore/Sources",
      publicHeadersPath: "Public",
      cSettings: [
        .headerSearchPath("../.."),
        .define("Firebase_VERSION", to: firebaseVersion),
        // TODO: - Add support for cflags cSetting so that we can set the -fno-autolink option
      ],
      linkerSettings: [
        .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS])),
        .linkedFramework("AppKit", .when(platforms: [.macOS])),
      ]
    ),
//...

  ],
  cLanguageStandard: .c99,
  cxxLanguageStandard: CXXLanguageStandard.gnucxx14
)

if ProcessInfo.processInfo.environment["FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT"] != nil {
  if let GoogleAppMeasurementIndex = package.dependencies
    .firstIndex(where: { $0.name == "GoogleAppMeasurement" }) {
    package.dependencies[GoogleAppMeasurementIndex] = .package(
      name: "GoogleAppMeasurement",
      url: "https://github.com/google/GoogleAppMeasurement.git",
      .branch("main")
    )
  }
}
1cklez4t

1cklez4t1#

对于任何面临同样问题的人。Firebase版本的格式为三位数X.X.X
将您的依赖项替换为:

dependencies: [
        .package(url: "https://github.com/firebase/firebase-ios-sdk.git", from: "8.0.0"),
        ...
        ...
    ],

请注意,我使用“8.0.0”而不是“8.0”。这非常令人困惑,因为Firebase自己的文档使用“8.0”。

相关问题