flutter-stripe / flutter_stripe

Flutter SDK for Stripe.
https://pub.dev/packages/flutter_stripe
956 stars 525 forks source link

Compatibility Issue: Concurrency Errors on iOS 15.0 with flutter_stripe Library #1355

Closed hwasiq closed 1 year ago

hwasiq commented 1 year ago

Issue Summary

I'm encountering compatibility errors related to concurrency features when using the flutter_stripe library on iOS 15.0. These features are only available in iOS 15.0 and newer, leading to build failures.

Actual Behavior

The build fails with the following error messages: "Swift Compiler Error: Concurrency is only available in iOS 15.0.0 or newer" "Swift Compiler Error: 'resume(with:)' is only available in iOS 15.0 or newer" "Swift Compiler Error: 'resume(with:)' is only available in iOS 15.0 or newer" "Swift Compiler Error: 'withCheckedThrowingContinuation(function:_:)' is only available in iOS 15.0 or newer" "Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code" ios/Pods/StripePayments/StripePayments/StripePayments/Source/API%20Bindings/STPAPIClient+Payments.swift:721:25

remonh87 commented 1 year ago

Can you upgrade to Xcode 13.2? I think concurrency is not supported in your Xcode version

JosephKalash commented 1 year ago

i think my issue is similar to this. Flutter project build is fail when I've added flutter_stripe package this is the output of flutter run command: `Uncategorized (Xcode): Command CompileSwift failed with a nonzero exit code

Swift Compiler Error (Xcode): 'data(for:delegate:)' is only available in iOS 15.0 or newer /Users/joseph/development/flutter/flutter_application_2/ios/Pods/StripePaymentsUI/StripePaymentsUI/StripePaymentsUI/Source/UI %20Components/PaymentMethodMessagingView.swift:296:55

Swift Compiler Error (Xcode): Cannot infer return type for closure with multiple statements; add explicit type to disambiguate /Users/joseph/development/flutter/flutter_application_2/ios/Pods/StripeFinancialConnections/StripeFinancialConnections/Stripe FinancialConnections/Source/Native/NetworkingLinkSignupPane/NetworkingLinkSignupViewController.swift:290:61

Could not build the application for the simulator. Error launching application on iPhone 13 Pro.`

Flutter: 3.10.6 stripe: 9.3.0 xcode: 3.14 ios deployment target: 15.0

hwasiq commented 1 year ago

No suitable solution has been found yet, even after updating Xcode.

JosephKalash commented 1 year ago

@hwasiq it's sad to hear that. is there an older version of the package which will be compatible with my env and not cause these build issues

hwasiq commented 1 year ago

I tried using flutter_stripe: ^9.2.2 as well, and I'm facing the same issue here too. The platform for this is also appearing as unknown on pub.

JosephKalash commented 1 year ago

I will try older version with IOS target 14.0. it should be work in certain version.

hwasiq commented 1 year ago

Could you please tell me which version of flutter_stripe you have used to resolve an issue?

JosephKalash commented 1 year ago

no I didn't solve the issue yet. i meant i will try other versions and one of them should be work, because it's not possible to keep crash

JosephKalash commented 1 year ago

@hwasiq the error in my case is represents in two files the first one is in file NetworkingLinkSignupViewController.swift line 291 if !didPrefillPhoneNumber { let didPrefillEmailAddress = {

and you can solve it by add Bool type to didPrefillEmailAddress var to explicitly define the type: if !didPrefillPhoneNumber { let didPrefillEmailAddress: Bool = {

the second is in PaymentMethodMessagingView.swift line 296 static func loadImage(url: URL, apiClient: STPAPIClient) async throws -> UIImage? { let request = apiClient.configuredRequest(for: url) let (data, _) = try await apiClient.urlSession.data(for: request) return UIImage(data: data, scale: 3)?.withRenderingMode(.alwaysOriginal) }

the error says Swift Compiler Error (Xcode): 'data(for:delegate:)' is only available in iOS 15.0 or newer I think the issue is the code not compatible with IOS or swift version. I'm not expert with swift and IOS development so i couldn't figure it out but i will try solve the problem. right now i commented the content of this function

remonh87 commented 1 year ago

I am able to compile it. Also make sure to have have the latest flutter hotfix for 3.7, I think it is 3.7.12 . I know the Flutter team back ported some Xcode command tools fixes

743306400 commented 1 year ago

Is there a solution to this problem? I also encountered it

JosephKalash commented 1 year ago

Unfortunately No they didn't fix it yet

remonh87 commented 1 year ago

please provide a reproduction example so we can further triage it because else I am inclined to close it. Can you try to compile the example app on iOS15?