Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 14.3 Beta Unable to compile with error 'MainActor' is only available in iOS 13.0 or newer #2181

Closed
5 tasks done
yishair-investing opened this issue Feb 20, 2023 · 21 comments

Comments

@yishair-investing
Copy link

yishair-investing commented Feb 20, 2023

Checklist before submitting a bug report

Xcode version

14.3 Beta

Facebook iOS SDK version

16.0.0

Dependency Manager

SPM

SDK Framework

Core

Goals

Compile the SDK and App.

Expected results

App should compile.

Actual results

App fails to compile with error message:

'MainActor' is only available in iOS 13.0 or newer

Steps to reproduce

Install SDK and try compile the app.

This could be related/duplicate #2180

@marinofelipe
Copy link

Having the same issue here 👍 , whenever compiling with Swift 5.8's toolchain

@BoOelkers
Copy link

Same as well

@kielgillard
Copy link

My team has this same issue with Xcode 14.3, too.

@jordikitto
Copy link

jordikitto commented Feb 23, 2023

Also seeing this with Xcode 14.3b1 - some other packages have already updated to handle this but not this package

@andre-alves
Copy link

Bump.. can't compile my app with Xcode 14.3 Beta and these frameworks:

FBSDKCoreKit
FBSDKLoginKit
FBSDKShareKit

@ecant
Copy link

ecant commented Feb 28, 2023

Seeing this in our app too. Just tested with Xcode 14.3 Beta 2 and the issue is still present.

@kielgillard
Copy link

kielgillard commented Feb 28, 2023

Can confirm, still present for beta 2.

@marinofelipe
Copy link

If only we could contribute to patching a fix.. but since it's an XCFramework that seems to use a remote source that we don't have access to 😅 🤷‍♂️ .. or perhaps we could fork and attempt to regenerate the local binary (though unsure precisely how the Facebook team does that), so...

Anyway, let us know if there's anything we can do to contribute towards having the fix earlier than later, Facebook team :)

@freddi-kit
Copy link

This would related to know issue: https://developer.apple.com/documentation/xcode-release-notes/xcode-14_3-release-notes#Known-Issues

@freddi-kit
Copy link

The Xcode “Strict Concurrency Checking” setting is not correctly passed to the compiler. If you set it to “Minimal” (the default), the compiler will still perform “Targeted” checks. (105637789)

Workaround: Add -Xfrontend -strict-concurrency=minimal to OTHER_SWIFT_FLAGS under your project’s Build Settings, or add -Xswiftc -strict-concurrency=minimal when running swift build.

@SunZhiC
Copy link

SunZhiC commented Mar 8, 2023

Follow Xcode alert, click fix button, the MainActor error should disappear.

@kielgillard
Copy link

This is still an issue in Xcode 14.3 beta 3.

It didn't seem like adding those compiler flags to my project did anything (I cannot see the compiler flags passed in the SwiftEmitModule step) #2181 (comment):

SwiftEmitModule normal arm64 Emitting\ module\ for\ FacebookLogin (in target 'FacebookLogin' from project 'Facebook')
    cd /REDACTED/SourcePackages/checkouts/facebook-ios-sdk
    builtin-swiftTaskExecution -- /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /REDACTED/SourcePackages/checkouts/facebook-ios-sdk/Sources/FacebookLogin/Exports.swift -target arm64-apple-ios11.0-simulator -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk -I /REDACTED/Build/Products/Debug-iphonesimulator -I /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib -F /REDACTED/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /REDACTED/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /REDACTED/Build/Products/Debug-iphonesimulator -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/Developer/Library/Frameworks -no-color-diagnostics -enable-testing -g -module-cache-path /Users/kgillard/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -profile-generate -profile-coverage-mapping -swift-version 5 -enforce-exclusivity\=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -empty-abi-descriptor -Xcc -working-directory -Xcc /REDACTED/SourcePackages/checkouts/facebook-ios-sdk -resource-dir /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -ivfsstatcache -Xcc /Users/kgillard/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator16.4-20E5238a-.sdkstatcache -Xcc -I/REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/swift-overrides.hmap -Xcc -I/REDACTED/Build/Products/Debug-iphonesimulator/include -Xcc -I/REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/DerivedSources-normal/arm64 -Xcc -I/REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/DerivedSources/arm64 -Xcc -I/REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG\=1 -module-name FacebookLogin -disable-clang-spi -target-sdk-version 16.4 -target-sdk-name iphonesimulator16.4 -emit-module-doc-path /REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/Objects-normal/arm64/FacebookLogin.swiftdoc -emit-module-source-info-path /REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/Objects-normal/arm64/FacebookLogin.swiftsourceinfo -emit-objc-header-path /REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/Objects-normal/arm64/FacebookLogin-Swift.h -serialize-diagnostics-path /REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/Objects-normal/arm64/FacebookLogin-master-emit-module.dia -emit-dependencies-path /REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/Objects-normal/arm64/FacebookLogin-master-emit-module.d -parse-as-library -o /REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/Objects-normal/arm64/FacebookLogin.swiftmodule -emit-abi-descriptor-path /REDACTED/Build/Intermediates.noindex/Facebook.build/Debug-iphonesimulator/FacebookLogin.build/Objects-normal/arm64/FacebookLogin.abi.json

Follow Xcode alert, click fix button, the MainActor error should disappear.

Which alert? Or is this what Facebook developer need to do to fix the FacebookLogin module?

@SajjadKharrazi
Copy link

Fixing with swiftlang/swift#64412.
tnx to @tshortli

@cameronehrlich
Copy link

Our team just ran into this with Xcode 14.3 RC using Xcode Cloud, hopefully @tshortli's fix makes it into the GM! 🤞

@leogiroux
Copy link

Our team just ran into this issue too, what can we do to solve it ? Our Xcode Cloud can't build testflight anymore.

@zhangjiemin000
Copy link

zhangjiemin000 commented Mar 22, 2023

try download swift 5.7.2 from https://www.swift.org/download . and change the toolchain of Xcode when install is done.

@xmollv
Copy link

xmollv commented Mar 22, 2023

Our team just ran into this with Xcode 14.3 RC using Xcode Cloud, hopefully @tshortli's fix makes it into the GM! 🤞

Yeah, we have the same issue with the RC in Xcode Cloud.

@jakesquareone
Copy link

XCode Cloud just stopped working for us too, what is the fix here @samodom?

@nirb1991
Copy link

I can see that it's already fixed here, but I'm still getting the error in Xcode 14.3 RC.
Does the RC version contain the fix?

@marinofelipe
Copy link

@nirb1991, nope. The fix was cherry picked to Swift 5.8 branch 3 days ago, so that hope is that it will make the next RC🤞

@raxityo
Copy link

raxityo commented Mar 27, 2023

This issue (along with #2180) 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_DISTRIBUTION enabled. These failures will occur when the XCFramework contains public Swift declarations that have @MainActor constraints implicitly added, such as subclasses of UIView or NSView. The Swift compiler expects those declarations to be marked @available for an operating system version where Swift concurrency is available.
(105610970)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests