未找到目标“AAA”的 SPM 工件 - 仅限 Xcode 13.3

Hen*_*bat 10 xcode swift swift-package-manager

我有与 SPM 一起安装的 SDK。它在 Xcode 13.2 上按预期工作,但在 Xcode 13.3 上我收到此错误。

import PackageDescription

let package = Package(
name: "AAA",
products: [
    .library(
        name: "AAA",
        targets: ["AAA"]),
],
dependencies: [
    
],
targets: [
    .binaryTarget(
                        name: "AAA",
                        path: "artifacts/BBB.xcframework"
                    ),
    .testTarget(
        name: "AAATests",
        dependencies: ["AAA"]),
]
Run Code Online (Sandbox Code Playgroud)

错误图像

Ori*_*Ori 18

工件名称必须与目标名称匹配(这是 Xcode 13.3 的新功能)。由于您的工件名称是 BBB.xcframework,因此下面的示例应该适合您:

let package = Package(
    name: "BBB",
    products: [
        .library(
            name: "BBB",
            targets: ["BBB"]),
    ],
    dependencies: [
        
    ],
    targets: [
        .binaryTarget(
            name: "BBB",
            path: "artifacts/BBB.xcframework"
        ),
    ]
)
Run Code Online (Sandbox Code Playgroud)