iosswiftswift-package-managerxcframeworkswift-package

Build error for device with swift package dependency. Cannot open file handle for file at path: Path(str: "... .framework")


I'm trying to create a swift package from existing xcframework. I can add it to my test app but I get that error: "Cannot open file handle for file at path: Path(str: "... .framework")" when I'm trying to compile the app. It happens for both device and simulator.

This is my Package.swift file:

// swift-tools-version: 5.6

import PackageDescription

let package = Package(
    name: "MyFramework",
    platforms: [
        .iOS(.v10)
    ],
    products: [
        .library(name: "MyFramework", targets: ["MyFramework"]),
    ],
    targets: [
        .binaryTarget(name: "MyFramework", path: "MyFramework.xcframework")
    ]
)

I can see that the xcframework do exist along the Package.swift in the same directory.

Does anyone know what's wrong here?


Solution

  • The issue was a wrong values in the plist file inside each framework for each architecture. CFBundleName and CFBundleExecutable were not equal to the name in the Package.swift file.