Swift:包依赖项添加到我的包中,但找不到模块。 FBSDKCoreKit,facebook-ios-sdk

问题描述 投票:0回答:1

first screen

second screen

您好,我在向我的包添加其他包的依赖项时遇到这样的问题。 可能是什么问题?

为什么找不到模块?它不仅仅与 Facebook 包有关。我尝试以同样的方式导入 MedalliaDigitalSDK,但它也不起作用。但是当我添加 FirebaseAnalytics 时,它识别了它并且没有发生错误......

swift facebook-ios-sdk swift-package-manager
1个回答
0
投票

这是我的 package.swift 文件

import PackageDescription

let package = Package(
    name: "MyLibrary",
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "MyLibrary",
            targets: ["MyLibrary"]),
    ],
    dependencies: [
        .package(url: "https://github.com/facebook/facebook-ios-sdk", from: "15.0.0"),
    ],
    targets: [
        // Targets are the basic building blocks of a package, defining a module or a test suite.
        // Targets can depend on other targets in this package and products from dependencies.
        .target(
            name: "MyLibrary",
            dependencies: [.product(name: "FacebookCore", package: "facebook-ios-sdk")]
        ),
            
        .testTarget(
            name: "MyLibraryTests",
            dependencies: ["MyLibrary"]),
    ]
)

并通过以下方式实现 AppEvents:

import FacebookCore

public struct MyLibrary {
    
    public init() {
        AppEvents.shared.logEvent(AppEvents.Name("battledAnOrc"))

    }
}

希望这会起作用。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.