-
Notifications
You must be signed in to change notification settings - Fork 328
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
Purchase sheet may fail to appear on iOS 18.2 #4611
Comments
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out! |
Hi @inb4ohnoes, Thanks for reporting this. Indeed it seems like StoreKit payments fail 100% of the time in App Extensions. I've added a workaround specifically for App Extensions to the |
Thanks so much @MarkVillacampa, I'll try this as soon as I get home and report back! |
Ok just tried that branch and it seems to be working. I'll try to rush my build through review and see if customers are still seeing the issue. Thanks! |
Does anyonw knows if this bug could affect the react native package ? |
same question about flutter https://x.com/luke_pighetti/status/1871180719692886062 |
@Lakston @lukepighetti the short answer is "yes it could" The bug is not specific to the RevenueCat SDK or the UI framework you're using, but to StoreKit, Apple's iOS framework for in-app purchases. The best way to test if your app is affected is trying to make a purchase on an iOS 18.2 device or simulator. If the purchases sheet pops up that means your app is not affected. |
There's a bug introduced by Apple in iOS 18.2 which prevents the payment sheet from being displayed if the current scene's key window root view controller is not part of the view hierarchy.
When the issue manifests, there is a log error message printed in the console:
Could not get confirmation scene ID for
This can happen if it is currently presenting a modal view controller with:
modalPresentationStyle = .fullScreen
on UIKitfullScreenCover(isPresented:onDismiss:content:)
in SwiftUITo workaround the issue:
modalPresentationStyle = .overFullScreen
on UIKitsheet(isPresented:onDismiss:content:)
on SwiftUIIf your app manifests the issue but these workarounds do not apply to your view structure, make sure your root view controller is part of the view hierarchy when initiating a purchase.
We're working on a workaround so purchases continue to work for users of our SDK: #4610
Technical details
Apple added a new purchase method in iOS 18.2 which accepts a
UIViewController
, as well as a macOS 15.2 one that accepts anNSWindow
.https://developer.apple.com/documentation/storekit/product/purchase(confirmin:options:)-3bivf
https://developer.apple.com/documentation/storekit/product/purchase(confirmin:options:)-8eai6
All the purchase methods were reimplemented internally, and the old
purchase(confirmIn:scene)
andpurchase(options:)
methods end up calling the newpurchase(confirmIn:viewController)
method.To select which
UIViewController
to pass as parameter, the algorithm roughly translates to:UIApplication.shared.connectedScenes.filter { $0.activationState == .foregroundActive }?.keyWindow?.rootViewController
However, when you present a view controller with
modalPresentationStyle = .fullScreen
over therootViewController
the documentation says:The views belonging to the presenting view controller are removed after the presentation completes.
This is equivalent to doing:
Which sure enough produces the dreaded
Could not get confirmation scene ID for message
.The text was updated successfully, but these errors were encountered: