Skip to content

[SwiftPM] Improve the error message if a plugin requires a higher deployment target version #165420

@loic-sharma

Description

@loic-sharma

Background

SwiftPM strictly enforces that your iOS target version is equal to or higher than your dependencies' iOS target version.

If your app target has a minimum deployment of iOS 12 but a SwiftPM plugin requires iOS 15, you'll get an error like: #162196 (comment)

Failed to build iOS app
Could not build the precompiled application for the device.
Target Integrity (Xcode): The package product 'cloud-firestore' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0

Target Integrity (Xcode): The package product 'firebase-core' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0

The solution to this problem is documented here: https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-app-developers#how-to-use-a-swift-package-manager-flutter-plugin-that-requires-a-higher-os-version

Suggestion

The Flutter CLI should catch this error and provide a more helpful error message. For example:

$ flutter run
Failed to build iOS app

Target Integrity (Xcode): The package product 'cloud-firestore' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0

To fix this, raise your app's minimum platform version or remove this dependency.

To increase your app's minimum platform version:

1. Open your app (ios/Runner.xcworkspace or macos/Runner.xcworkspace) in Xcode.
2. In the Project Navigator, select the Runner project > Runner target > General tab
3. Increase your app's target Minimum Deployments setting.
4. If you updated your iOS app's Minimum Deployments, regenerate the iOS project's configuration files:

   flutter build ios --config-only

5. If you updated your macOS app's Minimum Deployments, regenerate the macOS project's configuration files:

   flutter build macos --config-only

Part of #126005

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectplatform-iosiOS applications specificallyplatform-macBuilding on or for macOS specificallyteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions