Failed to build iOS Capacitor apps after upgrading from capacitor 6 to 7

Hello,

I recently migrate from capacitor 6 to 7, and then when building iOS apps, I get the following error:

xcodebuild: error: Could not resolve package dependencies:
Failed to resolve dependencies Dependencies could not be resolved because no versions of ‘capacitor-swift-pm’ match the requirement 7.4.3 and ‘capapp-spm’ depends on ‘capacitor-swift-pm’ 7.4.3.

When I do “npx cap sync”, and then I look under the generated Package.swift, it always set the value of the depenencies to “exact: 7.4.3”. But if I access the link “https://github.com/ionic-team/capacitor-swift-pm.git”, I cannot found any tag “7.4.3” there.

Here is how my Package.swift look like:

// swift-tools-version: 5.9
import PackageDescription

// DO NOT MODIFY THIS FILE - managed by Capacitor CLI commands
let package = Package(
    name: "CapApp-SPM",
    platforms: [.iOS(.v14)],
    products: [
        .library(
            name: "CapApp-SPM",
            targets: ["CapApp-SPM"])
    ],
    dependencies: [
        .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "7.4.3"),
        .package(name: "CapacitorApp", path: "../../../node_modules/@capacitor/app"),
        .package(name: "CapacitorBrowser", path: "../../../node_modules/@capacitor/browser"),
        .package(name: "CapacitorCamera", path: "../../../node_modules/@capacitor/camera"),
        .package(name: "CapacitorGeolocation", path: "../../../node_modules/@capacitor/geolocation"),
        .package(name: "CapacitorHaptics", path: "../../../node_modules/@capacitor/haptics"),
        .package(name: "CapacitorKeyboard", path: "../../../node_modules/@capacitor/keyboard"),
        .package(name: "CapacitorStatusBar", path: "../../../node_modules/@capacitor/status-bar")
    ],
    targets: [
        .target(
            name: "CapApp-SPM",
            dependencies: [
                .product(name: "Capacitor", package: "capacitor-swift-pm"),
                .product(name: "Cordova", package: "capacitor-swift-pm"),
                .product(name: "CapacitorApp", package: "CapacitorApp"),
                .product(name: "CapacitorBrowser", package: "CapacitorBrowser"),
                .product(name: "CapacitorCamera", package: "CapacitorCamera"),
                .product(name: "CapacitorGeolocation", package: "CapacitorGeolocation"),
                .product(name: "CapacitorHaptics", package: "CapacitorHaptics"),
                .product(name: "CapacitorKeyboard", package: "CapacitorKeyboard"),
                .product(name: "CapacitorStatusBar", package: "CapacitorStatusBar")
            ]
        )
    ]
)

Note that I followed the documentation mentioned in Updating to 7.0 | Capacitor Documentation, on how to upgrade capacitor 6 to 7.
And the android build succeed. Only the iOS present this issue.

Thanks in advance for any help.

The publish of 7.4.3 for SPM failed, I’ve just published it, sorry about that

2 Likes