0

在阅读了此处列出的有关如何将Firebase依赖项添加到 Swift 包的说明后,我无法让它工作,这是我的Package.swift清单:

import PackageDescription

let package = Package(
    name: "MyPackage",
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "MyPackage",
            targets: ["MyPackage"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(name: "Firebase",
                 url: "https://github.com/firebase/firebase-ios-sdk.git",
                 .upToNextMajor(from: "8.0.0"))
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
        .target(
            name: "MyPackage",
            dependencies: [.product(name: "FirebaseRemoteConfig", package: "Firebase")]),
        .testTarget(
            name: "MyPackageTests",
            dependencies: ["MyPackage"]),
    ]
)

Sources/MyPackage.swift包图可以毫无问题地解决,但是当我尝试从编译器开始添加自己的代码时import FirebaseRemoteConfig会抱怨: No such model 'FirebaseRemoteConfig'.

我的设置出了什么问题?

4

1 回答 1

1

我想出了解决方案,但不幸的是它没有记录在 Firebase Docs 中,我必须.platforms在清单中添加数组,Package.swift指定支持 FirebaseRemoteConfig 的版本,例如:

platforms: [
        .iOS(.v13)
    ]
于 2021-05-30T08:16:54.027 回答