facebook-ios-sdk
facebook-ios-sdk copied to clipboard
Pre-built XCFrameworks cannot be used with Xcode 14.3 / Swift 5.8
Checklist before submitting a bug report
- [X] I've updated to the latest released version of the SDK
- [X] I've searched for existing GitHub issues
- [X] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [X] I've read the Code of Conduct
- [X] This issue is not security related and can safely be disclosed publicly on GitHub
Xcode version
14.3 Beta
Facebook iOS SDK version
16.0.0
Dependency Manager
Prebuilt Binaries
SDK Framework
Core
Goals
Compile a project with pre-built Facebook SDKs linked.
Expected results
The project compiles successfully.
Actual results
I'm getting a following error:
.../FacebookAnalyticsWrapper.swift:4:8 Failed to build module 'FBSDKCoreKit'; this SDK is not supported by the compiler
(the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)',
while this compiler is 'Apple Swift version 5.8 (swiftlang-5.8.0.117.11 clang-1403.0.22.8.60)').
Please select a toolchain which matches the SDK.
The same applies to 15.1.0 binaries complaining about being built with Swift 5.6. In both cases, both Static and Dynamic ones result in this error.
As the configuration seems to already use BUILD_LIBRARY_FOR_DISTRIBUTION=YES, I have really no quick idea how to solve this. 🤔 SKIP_INSTALL=NO could have some potential, but I can't really say…
Testing
Test case here would be a successful linking in a project with both Xcode 14.2 and 14.3.
Escalation
I know that Xcode 14.3 is still in Beta, but I guess this needs to be addressed ASAP, on top of that I've got no issues with other pre-built SDKs like Firebase for example, which means that something's already wrong with the XCFrameworks distribution setup that would cause this issue regularly with Apple updating the compiler version in Xcode.
/Users/triwin/liveBingoWork/Xcode/Libraries/FacebookSDK/SDK/Editor/iOS/Swift/FBSDKTournamentUpdater.swift:21:8: Failed to build module 'FBSDKCoreKit'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)'). Please select a toolchain which matches the SDK.
same issue ,where 5.6 compiler
Experiencing the same issue with Xcode 14.3 Beta 1 and Beta 2:
Failed to build module 'FBSDKCoreKit';
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift
version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler
is 'Apple Swift version 5.8 (swiftlang-5.8.0.119.11 clang-1403.0.22.11.100)').
Please select a toolchain which matches the SDK.
Same issue with Xcode 14.3 Beta 2. https://github.com/facebook/facebook-ios-sdk/issues/2186
@sunlighing: Your issue looks similar, but is actually different – you can't use frameworks built by a newer Swift compiler version in Xcode/app using an older compiler version. Basically tl;dr: the newer compiler may generate chunks in the Swift module interface potentially not yet known by your (older) compiler version, so Library distribution only allows the framework to be consumed by the same or newer compiler version.
For the other guys: it won't differ with future Betas 'cause there's an issue with Library distribution/Module compatibility in place. The weird thing here is it complains about FBSDKCoreKit which has Swift interface included while I'd rather expect FBSDKCoreKit_Basics to be an issue as that one doesn't 🤔 but we'll see what Facebook devs have to say about the setup.
There is a work around for cocoapods, add these code to Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
It works with FBSDK 16.0 and Xcode Version 14.3 beta 2 (14E5207e)
This workaround is not working on the RC for us. With version 15 & 16.
Well, isn't CocoaPods building the libs from source? 🤔 In that case, the workaround isn't really needed…
TL;DR: SKIP_INSTALL=NO and BUILD_LIBRARY_FOR_DISTRIBUTION=YES needs to be set properly for building (in Xcode 14.2 so that it's then working with 14.2 and 14.3 as well); in this case in the xcconfig files. 👍 The patch/fix should be quite easy here, but I'll verify it in my setup first.
This issue has been fixed in Xcode 14.3 RC2. The app compiles and builds successfully for me 🎉
From the Relese Notes:
Fixed: The Swift compiler may fail to build modules for XCFramework dependencies that were built with
BUILD_LIBRARY_FOR_DISTRIBUTIONenabled. These failures will occur when the XCFramework contains public Swift declarations that have@MainActorconstraints implicitly added, such as subclasses ofUIVieworNSView. The Swift compiler expects those declarations to be marked@availablefor an operating system version where Swift concurrency is available. (105610970)
We see the same issue building binary xcframeworks for distribution with Xcode 14.1 and are considering continuing to build our binary distributions with Xcode 13.3.1 - https://github.com/firebase/firebase-ios-sdk/pull/11010
@paulb777 Weeeell…Apple will make it simple for us (with 14.1 minimum requirement), as every year. 😄
https://twitter.com/9to5mac/status/1640772265787760640
Hi!! Any solution on this? 😭
I am facing the same issue with Xcode 13.2
Cocoapod version 1.11.3 works for me
Can we resolve this issue by using the same Xcode version 13.2.1?