-
Notifications
You must be signed in to change notification settings - Fork 335
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
v4: Fix crash in iOS 11-12 when using MainActor #4718
base: release/4.43.3
Are you sure you want to change the base?
Conversation
…ting an array with type @mainactor lambda var foo: [@mainactor @sendable () -> Void] = []
@@ -27,7 +27,7 @@ class StoreKitRequestFetcher: NSObject { | |||
|
|||
private let requestFactory: ReceiptRefreshRequestFactory | |||
private var receiptRefreshRequest: SKRequest? | |||
private var receiptRefreshCompletionHandlers: [@MainActor @Sendable () -> Void] | |||
private var receiptRefreshCompletionHandlers: [@Sendable () -> Void] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to understand, we shouldn't be using @MainActor
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclusively in v4 of the iOS SDK. This is because it has a deployment target of iOS 11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v5 is iOS 13+ so we can use it there
I'd love if this can get merged. I'm using Version 4 of SDK on iOS 12 and when compiling it with Xcode 16 I'm getting this crash so I'm still compiling it with Xcode 15. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested and working on iOS 12, we should do a sanity pass to ensure we don't introduce any regression for newer devices and then ship!
public typealias PurchaseCompletedBlock = @MainActor @Sendable (StoreTransaction?, | ||
CustomerInfo?, | ||
PublicError?, | ||
Bool) -> Void | ||
public typealias PurchaseCompletedBlock = @Sendable (StoreTransaction?, | ||
CustomerInfo?, | ||
PublicError?, | ||
Bool) -> Void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to remove this reference otherwise we'd still get a crash, since we have places where we store collections of these @MainActor
references.
guess we don't get off that easy and I broke tests? |
…ernal @mainactor block. This way we avoid hitting the iOS 11 crash when initiailising a collection with a @mainactor block type, and we dont change the public interface.
…cessing the type metadata because the method is generic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just one question
CustomerInfo?, | ||
PublicError?, | ||
Bool) -> Void | ||
public typealias PurchaseCompletedBlock = @MainActor @Sendable (StoreTransaction?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one keeps the @MainActor
. I'm guessing it's not used anymore in this v4. If so, perhaps we should remove it completely to prevent potential future errors if we need to make a new release of v4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the concern around that one was about making further changes to the API - like, if your code relies on this being @MainActor
, you might have broken compilation after upgrading.
I mean, the original problem was to add @MainActor
in a non-minor anyway, but kinda don't want to repeat the same issue twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well kill the extra space
so it doesn't even show up in the diff tho 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it makes sense 👍
CustomerInfo?, | ||
PublicError?, | ||
Bool) -> Void | ||
public typealias PurchaseCompletedBlock = @MainActor @Sendable (StoreTransaction?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the concern around that one was about making further changes to the API - like, if your code relies on this being @MainActor
, you might have broken compilation after upgrading.
I mean, the original problem was to add @MainActor
in a non-minor anyway, but kinda don't want to repeat the same issue twice
CustomerInfo?, | ||
PublicError?, | ||
Bool) -> Void | ||
public typealias PurchaseCompletedBlock = @MainActor @Sendable (StoreTransaction?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well kill the extra space
so it doesn't even show up in the diff tho 😅
Fix crash on iOS 11 and 12 when compiling with Xcode 16 and instantiating an array with type @mainactor lambda
var foo: [@MainActor @Sendable () -> Void] = []