purchases-flutter icon indicating copy to clipboard operation
purchases-flutter copied to clipboard

Concurrently-executed local function 'complete()' must be marked as '@Sendable'

Open PawelZaw opened this issue 4 years ago • 16 comments

Hey,

I have a package in 4.3.1 version. Xcode - 13.3.1 version.

I had made pod install then I was starting to build an app. During building I received in debug console error:

Swift Compiler Error (Xcode): Concurrently-executed local function 'complete()' must be marked as '@Sendable' ../ios/Pods/RevenueCat/Sources/Purchasing/Purchases/PurchasesOrchestrator.swift:917:21

So I modified the code by adding @Sendable:

@Sendable @MainActor func complete() { completion?(transaction, nil, purchasesError, false) }

After change everything is fine. Please, check why an app can't be build without above modification.

PawelZaw avatar Oct 29 '22 09:10 PawelZaw

👀 SDKONCALL-162 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Oct 29 '22 09:10 RCGitBot

The fix for this will be released soon. Thanks for the report!

NachoSoto avatar Oct 29 '22 15:10 NachoSoto

The fix is out in version 4.3.2.

NachoSoto avatar Nov 01 '22 16:11 NachoSoto

Still facing this issue on latest version(4.4.3. Pod version: 4.14.3). Also tried to downgrade to 4.3.2. As expected, no result, 'cause the code on lines PurchasesOrchestrator.swift:918 didn't change, AFAIK.

Could not build the precompiled application for the device.
Uncategorized (Xcode): Command CompileSwift failed with a nonzero exit code

Swift Compiler Error (Xcode): Concurrently-executed local function 'complete()' must be marked as '@Sendable'
/Users/radom/StudioProjects/photo_finder/ios/Pods/RevenueCat/Sources/Purchasing/Purchases/PurchasesOrchestrator.swift:918:21


Error launching application on iPhone (Radomir).
flutter doctor
[✓] Flutter (Channel stable, 3.3.9, on macOS 12.2 21D49 darwin-x64, locale ru-RU)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Community Edition (version 2021.3.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

radomir9720 avatar Dec 06 '22 14:12 radomir9720

  • Which version of Xcode are you using?
  • Are you overriding the SWIFT_VERSION flag?
  • Are you changing the SWIFT_STRICT_CONCURRENCY compiler flag?

NachoSoto avatar Dec 09 '22 19:12 NachoSoto

@NachoSoto Hi.

  • Version of XCode was mentioned in my message(in flutter doctor) - 13.3
  • No, i don't think so. In every build configuration(Debug, Profile, and Release) SWIFT_VERSION is set to 5.0;
  • Also, i don't think that i have changed SWIFT_STRICT_CONCURRENCY. As i understand, SWIFT_STRICT_CONCURRENCY setting can be changed through GUI in XCode starting from 14 version(i have 13.3, so i can't). Manually(by editing some file), more so, i did not specify this setting.

radomir9720 avatar Dec 10 '22 10:12 radomir9720

I saw that the minimum required version of XCode is 13.3.1(i have 13.3). Looked into 13.3.1 XCode release notes, and i am not sure that the problem is in my version of XCode. There are a couple of fixes, that, as i understand, are not related to this issue.

radomir9720 avatar Dec 12 '22 09:12 radomir9720

That's a Flutter requirement (not sure why). The iOS SDK itself actually requires 13.2.1. So having 13.3 should compile this correctly. I'm still confused why you're receiving this error though. We have tests in CI using Xcode 13.2.x, 13.4.x, and 14.x, and it compiles correctly on all.

NachoSoto avatar Dec 12 '22 18:12 NachoSoto

I still face this problem flutter: 3.3.10 Xcode 13.3.1 purchases_flutter: ^4.7.0 cocoapods 1.11.2

/Users/builder/clone/ios/Pods/RevenueCat/Sources/Purchasing/Purchases/PurchasesOrchestrator.swift:947:22: error: concurrently-executed local function 'complete()' must be marked as '@Sendable' func complete() {

andersonmendesdev avatar Jan 27 '23 23:01 andersonmendesdev

Any updates? I am facing the same issues

BradyEdgar94 avatar Jan 29 '23 12:01 BradyEdgar94

Could you share a complete log of xcodebuild, including the command that produces this error?

NachoSoto avatar Feb 02 '23 19:02 NachoSoto

Could you share a complete log of xcodebuild, including the command that produces this error?

Flutter: 3.3.10 Dart: 2.18.6 Xcode 13.3.1 purchases_flutter: ^4.9.0 cocoapods 1.11.2 machine: Mac mini M1

flutter build ios --release --no-tree-shake-icons --no-codesign

Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx for device (ios-release)...
Running pod install...                                              3.5s
Running Xcode build...                                          
Xcode build done.                                           23.0s
Failed to build iOS app
Error output from Xcode build:
↳
    2023-02-03 12:08:24.223 xcodebuild[2759:29469] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    2023-02-03 12:08:24.223 xcodebuild[2759:29469] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/w2/rrf5p87d1bbfyphxc7jdnyvh0000gn/T/flutter_tools.JQUKCl/flutter_ios_build_temp_diricnkbx/temporary_xcresult_bundle

    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/share_plus-6.3.0/ios/Classes/FLTSharePlusPlugin.m:26:46: warning: 'keyWindow' is deprecated: first deprecated in iOS 13.0 - Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes [-Wdeprecated-declarations]
        return [UIApplication sharedApplication].keyWindow.rootViewController;
                                                 ^
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/share_plus/share_plus-prefix.pch:2:
    /Applications/Xcode-13.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:135:51: note: 'keyWindow' has been explicitly marked deprecated here
    @property(nullable, nonatomic,readonly) UIWindow *keyWindow API_DEPRECATED("Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes", ios(2.0, 13.0));
                                                      ^
    1 warning generated.
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/permission_handler_apple-9.0.4/ios/Classes/strategies/PhonePermissionStrategy.m:50:35: warning: 'subscriberCellularProvider' is deprecated: first deprecated in iOS 12.0 [-Wdeprecated-declarations]
        CTCarrier *carrier = [netInfo subscriberCellularProvider];
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                      serviceSubscriberCellularProviders
    In module 'CoreTelephony' imported from /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/permission_handler_apple-9.0.4/ios/Classes/strategies/PhonePermissionStrategy.m:8:
    /Applications/Xcode-13.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:112:50: note: property 'subscriberCellularProvider' is declared deprecated here
    @property(readonly, retain, nullable) CTCarrier *subscriberCellularProvider API_DEPRECATED_WITH_REPLACEMENT("serviceSubscriberCellularProviders", ios(4.0, 12.0)) API_UNAVAILABLE(macos);
                                                     ^
    /Applications/Xcode-13.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:112:50: note: 'subscriberCellularProvider' has been explicitly marked deprecated here
    1 warning generated.
    4 warnings generated.
    /Users/builder/clone/ios/Pods/libwebp/src/enc/backward_references_enc.c:725:12: warning: variable 'best_offset' may be uninitialized when used here [-Wconditional-uninitialized]
              (best_offset << MAX_LENGTH_BITS) | (uint32_t)best_length;
               ^~~~~~~~~~~
    /Users/builder/clone/ios/Pods/libwebp/src/enc/backward_references_enc.c:657:20: note: initialize the variable 'best_offset' to silence this warning
        int best_offset;
                       ^
                        = 0
    1 warning generated.
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/in_app_review-2.0.4/ios/Classes/InAppReviewPlugin.m:91:14: warning: 'openURL:' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
            [app openURL:url];
                 ^~~~~~~
                 openURL:options:completionHandler:
    In module 'UIKit' imported from /Users/builder/clone/ios/Pods/Target Support Files/in_app_review/in_app_review-prefix.pch:2:
    /Applications/Xcode-13.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:124:1: note: 'openURL:' has been explicitly marked deprecated here
    - (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:", ios(2.0, 10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    1 warning generated.
    35 warnings generated.
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/flutter_barcode_scanner-2.0.0/ios/Classes/SwiftFlutterBarcodeScannerPlugin.swift:559:36: warning: 'statusBarOrientation' was deprecated in iOS 13.0: Use the interfaceOrientation property of the window scene instead.
                : UIApplication.shared.statusBarOrientation.isPortrait
                                       ^
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/flutter_barcode_scanner-2.0.0/ios/Classes/SwiftFlutterBarcodeScannerPlugin.swift:700:35: warning: 'scanHexInt32' was deprecated in iOS 13.0
        if (!Scanner(string: cString).scanHexInt32(&rgbaValue)) {
                                      ^
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/cryptography_flutter-2.0.2/ios/Classes/SwiftCryptographyFlutterPlugin.swift:60:17: warning: result of call to function returning 'T' is unused
                try fn()
                    ^ ~~
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.6.3/ios/Classes/SwiftContactsServicePlugin.swift:230:17: warning: initialization of immutable value 'contactViewController' was never used; consider replacing with assignment to '_' or removing it
                let contactViewController = CNContactViewController.init(forNewContact: nil)
                ~~~~^~~~~~~~~~~~~~~~~~~~~
                _
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.6.3/ios/Classes/SwiftContactsServicePlugin.swift:280:66: warning: 'keyWindow' was deprecated in iOS 13.0: Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes
                    var currentViewController = UIApplication.shared.keyWindow?.rootViewController
                                                                     ^
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.6.3/ios/Classes/SwiftContactsServicePlugin.swift:284:111: warning: 'gray' was deprecated in iOS 13.0: renamed to 'UIActivityIndicatorView.Style.medium'
                    let activityIndicatorView = UIActivityIndicatorView.init(style: UIActivityIndicatorView.Style.gray)
                                                                                          ^
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.6.3/ios/Classes/SwiftContactsServicePlugin.swift:284:111: note: use 'UIActivityIndicatorView.Style.medium' instead
                    let activityIndicatorView = UIActivityIndicatorView.init(style: UIActivityIndicatorView.Style.gray)
                                                                                          ^~~~
                                                                                          UIActivityIndicatorView.Style.medium
    /Users/builder/programs/flutter_3_3_10/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.6.3/ios/Classes/SwiftContactsServicePlugin.swift:285:69: warning: 'keyWindow' was deprecated in iOS 13.0: Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes
                    activityIndicatorView.frame = (UIApplication.shared.keyWindow?.frame)!
                                                                        ^
    /Users/builder/clone/ios/Pods/RevenueCat/Sources/Purchasing/Purchases/PurchasesOrchestrator.swift:947:22: error: concurrently-executed local function 'complete()' must be marked as '@Sendable'
                    func complete() {
                         ^
    Command CompileSwiftSources failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

    Result bundle written to path:
    	/var/folders/w2/rrf5p87d1bbfyphxc7jdnyvh0000gn/T/flutter_tools.JQUKCl/flutter_ios_build_temp_diricnkbx/temporary_xcresult_bundle


Swift Compiler Error (Xcode): Concurrently-executed local function 'complete()' must be marked as '@Sendable'
/Users/builder/clone/ios/Pods/RevenueCat/Sources/Purchasing/Purchases/PurchasesOrchestrator.swift:946:21

Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

Encountered error while building for device.


Build failed :|
Step 10 script `cd . && flutter build ios --release --no-tree-shake-icons --no-codesign` exited with status code 1

andersonmendesdev avatar Feb 03 '23 12:02 andersonmendesdev

Is there a chance flutter / CocoaPods are using a different version of Xcode under the hood?

I don't have Xcode 13.3.1, but with both 13.2.1 and 13.4.1, that code compiles correctly. If you modify /Users/builder/clone/ios/Pods/RevenueCat/Sources/Purchasing/Purchases/PurchasesOrchestrator.swift line 946 to add @Sendable, does it compile? Starting with Swift 5.6 (which Xcode 13.1 has), following that error and adding @Sendable produces

Main actor-isolated synchronous local function 'complete()' cannot be marked as '@Sendable'; this is an error in Swift 6

While we do support Xcode 13.2.1, another thing I would try is upgrading to Xcode 13.4.1 which still supports macOS 12. Let me know if that works.

NachoSoto avatar Feb 03 '23 18:02 NachoSoto

xcode 13.4.1 works fine.

andersonmendesdev avatar Feb 03 '23 23:02 andersonmendesdev

Glad to hear! That code has a condition to check for an older and newer version of Swift. I wonder if the version in 13.3.1 had a bug.

NachoSoto avatar Feb 04 '23 00:02 NachoSoto

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.

github-actions[bot] avatar Mar 29 '26 00:03 github-actions[bot]