Skip to content

Fixed PurchasesOrchestrator compilation error on Xcode 14.3 beta 1#2292

Merged
NachoSoto merged 1 commit into
mainfrom
nacho/sdk-2875-look-into-xcode-143-compile-failure
Feb 17, 2023
Merged

Fixed PurchasesOrchestrator compilation error on Xcode 14.3 beta 1#2292
NachoSoto merged 1 commit into
mainfrom
nacho/sdk-2875-look-into-xcode-143-compile-failure

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

Fixes #2291.

This has led to issues in the past too (#1994, #2221, RevenueCat/purchases-flutter#516, RevenueCat/purchases-flutter#507) because I tried to reuse that code to call a single completion method.
The new version of Swift makes that impossible now, because it detects that @MainActor isn't available in iOS 12.

To finally work around all those issues, this simply duplicates this single line of code, which should work across all versions of Swift.

Fixes #2291.

This has led to issues in the past too (#1994, #2221, 	RevenueCat/purchases-flutter#516, RevenueCat/purchases-flutter#507) because I tried to reuse that code to call a single completion method.
The new version of Swift makes that impossible now, because it detects that `@MainActor` isn't available in iOS 12.

To finally work around all those issues, this simply duplicates this single line of code, which should work across all versions of Swift.
@NachoSoto NachoSoto added the pr:fix A bug fix label Feb 17, 2023
@NachoSoto NachoSoto requested a review from a team February 17, 2023 16:13
Comment on lines 960 to +965
if finishable {
self.finishTransactionIfNeeded(transaction) { complete() }
self.finishTransactionIfNeeded(transaction) {
completion?(transaction, nil, purchasesError, false)
}
} else {
complete()
completion?(transaction, nil, purchasesError, false)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly this is easier to read too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah totally 🤷🏻‍♂️ not sure why I didn't realize it earlier that we could go back to this.

@NachoSoto NachoSoto enabled auto-merge (squash) February 17, 2023 19:12
@NachoSoto NachoSoto merged commit 9ac34ec into main Feb 17, 2023
@NachoSoto NachoSoto deleted the nacho/sdk-2875-look-into-xcode-143-compile-failure branch February 17, 2023 19:16
This was referenced Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Xcode 14.3 support

3 participants