Purchase sheet may fail to appear on iOS 18.2
UPDATE 2025/03/03: iOS 18.3 fixed this issue.
UPDATE 2025/01/22: It seems iOS 18.3 RC fixes this issue and will be generally available very soon.
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 = .fullScreenon UIKitfullScreenCover(isPresented:onDismiss:content:)in SwiftUI
To workaround the issue:
- Use
modalPresentationStyle = .overFullScreenon UIKit - Use
sheet(isPresented:onDismiss:content:)on SwiftUI
If 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: https://github.com/RevenueCat/purchases-ios/pull/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 an NSWindow.
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) and purchase(options:) methods end up calling the new purchase(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 the rootViewController the documentation says: The views belonging to the presenting view controller are removed after the presentation completes.
This is equivalent to doing:
// self is a UIViewController
self.view.removeFromSuperview()
try await product.purchase(confirmIn: self, options: [])
Which sure enough produces the dreaded Could not get confirmation scene ID for message.
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
Wanted to add, this issue manifests itself as a console log Could not find a UI anchor for xxx purchase.. I'm using RevenueCat in an iMessage app and I'm running into this issue.
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 purchase-18.2 branch. Could you test it and let me know if it fixes the issue for you?
https://github.com/RevenueCat/purchases-ios/pull/4610/commits/26c5a6a44c976431e7aedad98543577ffea13ce3
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.
Hi, @MarkVillacampa . Could you please let me know when the bug fix will be released? We are encountering the same error and cannot determine the specific version related to this issue, as we are using the RevenueCat SDK, which depends on version 5.14.4.
Hi @MarkVillacampa , Our app was rejected because the App Store reviewer was unable to initiate the subscription. Could you please let me know when the bug fix will be released?
Reviewer message: We found that your in-app purchase products exhibited one or more bugs which create a poor user experience. Specifically, the app showed error product not available when we attempted to purchase subscriptions. Please review the details and resources below and complete the next steps.
Review device details:
- Device type: iPad Air (5th generation)
- OS version: iPadOS 18.2
Hello @amucahidbozkurt,
Are you able to reproduce the issue on your own device or simulator in the Sandbox environment, and specifically seeing the "Could not get confirmation scene ID for" message in the Console?
Asking because in the issue you mention "missing products" rather than not being able to purchase the products which is an issue thay is sometimes common when submitting an app for review whith newly created products.
Same Here! i'm getting the issue, i think it is really certain cause my customers cannot purchase in my prod apps.
I have 4 apps in production from the same source of code. they are different only in JSON files used as sources. two of the apps fails with the same error (BOTH production!!! and sandbox) failing apps is for BY (Belarus) and RU (Russia) regions two others works fine: they are for KZ (Kazakhstan) and UK (the Ukraine) regions.
Is it some kind of sanctions from Revenue cat? Guys please put attention on this @revenuecat-ops @RCGitBot @revenuecat-circleci-ios-certs @aboedo
this is so critical because people loosing money and customers
Unhandled error happened: Error Domain=RevenueCat.ErrorCode Code=2 "There was a problem with the App Store." UserInfo={NSLocalizedDescription=There was a problem with the App Store., NSUnderlyingError=0x301b43060 {Error Domain=StoreKit.StoreKitError Code=2 "Не удается выполнить запрос"}, readable_error_code=STORE_PROBLEM, source_file=RevenueCat/StoreKitError+Extensions.swift:43, source_function=asPurchasesError}
but the most crazies moment here is that the same builds works fine on other devices: it fails on my iPhone 13 Pro with 18.2.1 but it works on my iPad Pro 18.3 (BOTH production!!! and sandbox)
Same problem, sometimes I'm getting the error "There was a problem with the App Store.", but if payment sheet gets open - the free trial information is missing even if product has correctly set a free trial.
@FurkanHanciSecond sorry to hear you're hitting this issue. I'm hoping the recommendations from the issue details can help you track down the root cause of the bug in your app and potentially fix the issue.
@astrokin I believe your apps are experiencing this exact issue, but it's not relaxed to the country of origin. I was able to download your apps and reproduce the issue where the payment sheet does not pop up and I can see the message Could not get confirmation scene ID for using Console.app. I also recommend checking the instructions in the issue details which can help you track down the root cause of the bug in your app and potentially fix it.
@euroboy If payment sheet does not open sometimes, it can be because of this issue. Do you see the Could not get confirmation scene ID for message in the Xcode logs when that happens? The reason for the missing free trial information could be you're using an Apple Sandbox account that has already purchased before. If so I recommend creating a new Sandbox Account to test it.
To all three, if you're unable to track down the issue in your apps please write to me at mark (at) revenuecat.com and I will try to help you personally.
@MarkVillacampa thank you for the answer and especially thank you for testing my app. Could you please explain how the console message Could not get confirmation scene ID for is related to the API error Unhandled error happened: Error Domain=RevenueCat.ErrorCode Code=2 "There was a problem with the App Store." UserInfo={NSLocalizedDescription=There was a problem with the App Store., NSUnderlyingError=0x301b43060 {Error Domain=StoreKit.StoreKitError Code=2 "Не удается выполнить запрос"}, readable_error_code=STORE_PROBLEM, source_file=RevenueCat/StoreKitError+Extensions.swift:43, source_function=asPurchasesError}
It would be great if you could give more details about the error and how to possibly fix it. As far as I understand it's not UI related issue. Sorry if I've missed something
Hi @astrokin, when the issue presents itself, StoreKit prints Could not get confirmation scene ID for to the console and then throws a StoreKitError.unknown error when the RevenueCat SDK calls StoreKit’s product.purchase() function. Our SDK catches this unknown error and then sends it back to your app’s code with the There was a problem with the App Store. error mentioned in your comment.
The underlying bug is actually UI related. StoreKit can't present the payment sheet because it cannot find a view to do it. This can happen when you're presenting a modal view controller with modalPresentationStyle = .fullScreen. There's more details in the issue description, in the first message of this thread.
Hi, React Native also seems to affected, at least in my testing on real device with iOs 18.2.1. Is there any workaround? I have tried both a modal and a separate screen/View to no avail, the subscription is processed correctly but when trying to return the purchase info StoreKit.StoreKitError is thrown.
@butterfly-valley Hi! You mention "the subscription is processed correctly", does this mean the purchase sheet with the price, etc opens up? If you can open the purchase sheet then this is a different issue.
I have the same issue:
@butterfly-valley Hi! You mention "the subscription is processed correctly", does this mean the purchase sheet with the price, etc opens up? If you can open the purchase sheet then this is a different issue.
The subscription is processed correctly because it is active in the sandbox account. I can cancel it and purchase it again and again but there is no visual confirmation and this error is thrown.
@butterfly-valley Hi! You mention "the subscription is processed correctly", does this mean the purchase sheet with the price, etc opens up? If you can open the purchase sheet then this is a different issue.
It might have a user error from my side. I have implemented the workflow on Android, pushed the code and tested on iOs with no issues. Please accept my apologies.
@Toni77777 do you also see the Could not get confirmation scene ID for message? If not, you might be experiencing a different issue.
@butterfly-valley glad to know it's working for you now :)
Hi @MarkVillacampa, Have you updated the bug fix for iOS 18.2? We are encountering an issue that prevents our users from seeing the Payment Sheet. We are integrating it with RevenueCat, but this issue is blocking us from migrating from the native StoreKit2 to RevenueCat. So I would like to ask about the release plan for this issue. Thank you.
@MarkVillacampa Yes, I got Could not get confirmation scene ID for message. But I present my paywall in another UIWindow.