Swift 包:找不到依赖包。补救?
Swift Package: Dependent Package can't be found. Remedy?
背景: 我今天早些时候使用不同的依赖项作为 'proof of concept' 创建了一个 successful package <--- dependency。
然而 Facebook SDK 包 依赖项未能被识别:
这里是 package.swift:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "CVSFacebookAccess",
platforms: [
.iOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "CVSFacebookAccess",
targets: ["CVSFacebookAccess"]),
],
dependencies: [
.package(name: "Facebook", url: "https://github.com/facebook/facebook-ios-sdk.git", from: "11.0.1")
],
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: "CVSFacebookAccess",
dependencies: ["Facebook"]),
.testTarget(
name: "CVSFacebookAccessTests",
dependencies: ["CVSFacebookAccess"])
]
)
这是 Facebook 包:
问题:
为什么无法识别Facebook SDK?
我正在关注相同的 Swift PM syntax as before.
iOS 包的 Facebook SDK 包含几个库,例如:FacebookCore
、FacebookLogin
、FacebookShare
、FacebookGamingServices
,您应该依赖于一个需要的,例如:
...
.target(
name: "YourPackage",
dependencies: [.product(name: "FacebookLogin", package: "Facebook")]),
...
然后你就可以在你的代码中使用这个库了:
import FBSDKLoginKit
func createLoginButton() -> FBLoginButton {
return FBLoginButton()
}
背景: 我今天早些时候使用不同的依赖项作为 'proof of concept' 创建了一个 successful package <--- dependency。
然而 Facebook SDK 包 依赖项未能被识别:
这里是 package.swift:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "CVSFacebookAccess",
platforms: [
.iOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "CVSFacebookAccess",
targets: ["CVSFacebookAccess"]),
],
dependencies: [
.package(name: "Facebook", url: "https://github.com/facebook/facebook-ios-sdk.git", from: "11.0.1")
],
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: "CVSFacebookAccess",
dependencies: ["Facebook"]),
.testTarget(
name: "CVSFacebookAccessTests",
dependencies: ["CVSFacebookAccess"])
]
)
这是 Facebook 包:
问题:
为什么无法识别Facebook SDK?
我正在关注相同的 Swift PM syntax as before.
iOS 包的 Facebook SDK 包含几个库,例如:FacebookCore
、FacebookLogin
、FacebookShare
、FacebookGamingServices
,您应该依赖于一个需要的,例如:
...
.target(
name: "YourPackage",
dependencies: [.product(name: "FacebookLogin", package: "Facebook")]),
...
然后你就可以在你的代码中使用这个库了:
import FBSDKLoginKit
func createLoginButton() -> FBLoginButton {
return FBLoginButton()
}