Firebase [Swift 包管理器]:没有这样的模块 FirebaseRemoteConfig
Firebase [Swift Package Manager]: no such module FirebaseRemoteConfig
在我阅读 here 列出的关于如何将 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'
.
我的设置出了什么问题?
我找到了解决方案,但遗憾的是它没有记录在 Firebase 文档中,我必须在 Package.swift
清单中添加 .platforms
数组,指定支持 FirebaseRemoteConfig 的版本,例如:
platforms: [
.iOS(.v13)
]
在我阅读 here 列出的关于如何将 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'
.
我的设置出了什么问题?
我找到了解决方案,但遗憾的是它没有记录在 Firebase 文档中,我必须在 Package.swift
清单中添加 .platforms
数组,指定支持 FirebaseRemoteConfig 的版本,例如:
platforms: [
.iOS(.v13)
]