Failed to build module 'CustomSDK'; SDK not supported by compiler due to Swift version mismatch on Xcode 16 Beta 6

I’m facing an issue while compiling a project with a CustomSDK on Xcode 16.0 Beta 6. The following error is displayed during the build process:

Failed to build module 'CustomSDK'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)', while this compiler is 'Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)'). Please select a toolchain which matches the SDK.

Steps I have taken so far:

  1. Set the BUILD_LIBRARY_FOR_DISTRIBUTION build setting to YES in the post_install script to ensure forward compatibility.
  2. Cleaned the project and deleted Derived Data.
  3. Verified that the latest SDK version was compiled using Swift 5 in Xcode 15.2, which should ensure compatibility with future versions.
  4. Tried re-adding the SDK pod and rebuilt the project.

Despite these steps, the issue persists on Xcode 16 Beta 6. I suspect the problem could be related to a beta version of Xcode and compatibility issues, but I need guidance on how to ensure the SDK works with Xcode 16.

Is this a known issue with Swift versioning in the beta release? Are there any workarounds or specific changes I should apply to make the SDK work with Xcode 16 Beta 6?

Any help or suggestions would be appreciated!

Answered by DTS Engineer in 803379022

In general, Xcode N should be able to use XCFrameworks generated by Xcode M, where M ≤ N, as long as the framework was built with library evolution enabled [1].

You mentioned “pod”, which suggests you’re using CocoaPods. If you want to investigate this further, I recommend that you focus on Apple tools. That it, build your XCFramework with Xcode 15 and its related tooling, add that directly to an Xcode 16 test client project, and try building that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] This is controlled by the Build Libraries for Distribution build setting, which it seems that you’re setting.

Are using “CustomSDK” to mean a library you got from some other third-party developer?

If so, I recommend that you contact that developer about this. They’re in the best position to help you debug this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@DTS Engineer Yes, customSDK is a third-party framework, and I am the owner. The issue was reported by a client who integrated the SDK into their app. I am seeking a response directly from the Apple team, as they are in the best position to explain why my SDK is not compiling on Xcode 16 Beta 6.

In general, Xcode N should be able to use XCFrameworks generated by Xcode M, where M ≤ N, as long as the framework was built with library evolution enabled [1].

You mentioned “pod”, which suggests you’re using CocoaPods. If you want to investigate this further, I recommend that you focus on Apple tools. That it, build your XCFramework with Xcode 15 and its related tooling, add that directly to an Xcode 16 test client project, and try building that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] This is controlled by the Build Libraries for Distribution build setting, which it seems that you’re setting.

@DTS Engineer Thanks for the response. I'll check this out, but what will be established with this exercise?

what will be established with this exercise?

It further isolates the problem.

Right now we don’t know if this is an Xcode issue per se or an issue triggered in Xcode by your third-party package manager. The result of this test will tell you that. And that’s important because, if it’s the latter, it’d be best for you to escalate this via its support channel.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I'm having a similar issue, with internal xcframeworks packaged in Cocoapods : Failed to build module 'Common'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)', while this compiler is 'Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)'). Please select a toolchain which matches the SDK.

The problem, is that the xcframeworks were built using Xcode 16.0, with BUILD_LIBRARY_FOR_DISTRIBUTION set to YES, but and I'm getting this error on Xcode 16.0 in an app that I'm trying to build using those xcframeworks.

Update : I don't reproduce the problem when using the xcframeworks directly instead of through cocoapods, so I guess that's where the problem lies.

Failed to build module 'CustomSDK'; SDK not supported by compiler due to Swift version mismatch on Xcode 16 Beta 6
 
 
Q