Stripe flutter error: Unable to infer complex closure return type; add explicit type to disambiguate

134 Views Asked by At

I just started getting this issue after adding flutter stripe package while running the app. I can't figure out why this issue coming again and again. I tried several solutions including pod install several times deleting pod lock file and pod folder. My xcode version is 13.2.1 and flutter is 3.0.0.

Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/s3/qg6_sd_x7v9c5p0xzgwd3sjr0000gn/T/flutter_tools.J74G6G/flutter_ios_build_temp_dirNRJtwQ/temporary_xcresult_bundle

    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/Analytic+Payments.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/NSDecimalNumber+Stripe_Currency.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/STPAPIClient+ApplePay.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/STPBankAccount.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/STPBankAccountParams.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:301:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:520:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:523:31: error: variable binding in a condition requires an initializer
                if let setupIntent, error == nil {
                                  ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/STPIntentActionVerifyWithMicrodeposits.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:301:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:520:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:523:31: error: variable binding in a condition requires an initializer
                if let setupIntent, error == nil {
                                  ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/STPKlarnaLineItem.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:301:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:520:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:523:31: error: variable binding in a condition requires an initializer
                if let setupIntent, error == nil {
                                  ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/STPMandateCustomerAcceptanceParams.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:301:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:520:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:523:31: error: variable binding in a condition requires an initializer
                if let setupIntent, error == nil {
                                  ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/arm64/STPMandateDataParams.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:301:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:520:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:523:31: error: variable binding in a condition requires an initializer
                if let setupIntent, error == nil {
                                  ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/Library/Developer/Xcode/DerivedData/Runner-fsxrcxlpwvnsjwaxkmmacfdixrme/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/StripePayments.build/Objects-normal/x86_64/Analytic+Payments.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'StripePayments' from project 'Pods')
    Command CompileSwift failed with a nonzero exit code
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:56:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API Bindings/APIRequest.swift:98:42: error: variable binding in a condition requires an initializer
                    guard let responseObject else {
                                             ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:301:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:520:28: error: variable binding in a condition requires an initializer
                guard let self else {
                               ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:523:31: error: variable binding in a condition requires an initializer
                if let setupIntent, error == nil {
                                  ^
    /Users/apple/StudioProjects/test2/ios/Pods/StripeFinancialConnections/StripeFinancialConnections/StripeFinancialConnections/Source/Native/NetworkingLinkSignupPane/NetworkingLinkSignupViewController.swift:291:62: error: unable to infer complex closure return type; add explicit type to disambiguate
                                    let didPrefillEmailAddress = {
                                                                 ^
                                                                   () -> <#Result#> in 
    /Users/apple/StudioProjects/test2/ios/Pods/StripeFinancialConnections/StripeFinancialConnections/StripeFinancialConnections/Source/Native/NetworkingLinkSignupPane/NetworkingLinkSignupViewController.swift:291:62: error: unable to infer complex closure return type; add explicit type to disambiguate
                                    let didPrefillEmailAddress = {
                                                                 ^
                                                                   () -> <#Result#> in 
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')

    Result bundle written to path:
        /var/folders/s3/qg6_sd_x7v9c5p0xzgwd3sjr0000gn/T/flutter_tools.J74G6G/flutter_ios_build_temp_dirNRJtwQ/temporary_xcresult_bundle


Swift Compiler Error (Xcode): Unable to infer complex closure return type; add explicit type to disambiguate
/Users/apple/StudioProjects/test2/ios/Pods/StripeFinancialConnections/StripeFinancialConnections/StripeFinancialConnections/Source/Native/NetworkingLinkSignupPane/NetworkingLinkSignupViewController.swift:290:61

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

Swift Compiler Error (Xcode): Variable binding in a condition requires an initializer
/Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API%20Bindings/APIRequest.swift:55:41

Swift Compiler Error (Xcode): Variable binding in a condition requires an initializer
/Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/Internal/API%20Bindings/APIRequest.swift:97:41

Swift Compiler Error (Xcode): Variable binding in a condition requires an initializer
/Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:300:27

Swift Compiler Error (Xcode): Variable binding in a condition requires an initializer
/Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:519:27

Swift Compiler Error (Xcode): Variable binding in a condition requires an initializer
/Users/apple/StudioProjects/test2/ios/Pods/StripePayments/StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift:522:30

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

0

There are 0 best solutions below