StoreKit 2 failure on tvOS 18.2

Please help! I have a subscription IAP failing on tvOS 18.2 at:

func makePurchase(_ product: Product) async throws
    {       
        let result = try await product.purchase() //ERROR OCCURS HERE (See error message below)
...

Xcode Console message: "Could not get confirmation scene ID for [insert my IAP id here]"

The IAP subscription was working fine on 18.1 and earlier, and the same IAP and code is also running fine on iOS 18.2. The tvOS error on 18.2 happens both in production and sandbox.

Are there any changes to StoreKit 2 which might cause this error?

Additional info: From my own paywall viewController:

try await store.makePurchase(productToPurchase)

And in my NSObject store helper class:

func makePurchase(_ product: Product) async throws
    {       
        let result = try await product.purchase() //ERROR OCCURS HERE (See error message below)

Xcode Console message: "Could not get confirmation scene ID for [insert my IAP id here]"

Why is the is tvOS 18.2 API looking for a scene ID? (Again, works fine for 18.1 and on iOS 18.2)

Update 11-14-24; I have determined this failure occurs when the paywall (which calls the purchase(options:) method in my "store manager" class) is not a primary viewController window. ie.

Tab Bar Controller -> 1st viewController as paywall DOES work.

Tab Bar Controller -> 1st viewController -- <segue> --> 2nd viewController as paywall DOES NOT work.

Any clues or insight why this may be happening would be greatly apprecaiated. Thanks!

Looking like StoreKit UI will not load or respond in tvOS 18.2 unless there is a Navigation Controller present AND you ONLY use a Push segue to get to your paywall viewController.

Been playing with adding a Navigation controller and hiding the tabBar in code on subsequent viewController push (as a workaround), but the push animation is not in time with the viewController. (Not as smooth a visual transition)

I encountered the same error in iOS 18.2(22C5142a).

same error in iOS 18.2(22C150).

Same error at iphone in iOS 18.2

I have a payment view wrapped like this:

.fullScreenCover(isPresented: $showUpgrade) { SubscribeView() }

I followed with your discovery and change to:

.popover(isPresented: $showUpgrade) { SubscribeView() }

The paywall shows up again.

Running into the same issue with iOS 18.2 using UIKit (Purchases work as expected with iOS 18.1). I have my purchases in views that are shown as .modalPresentationStyle = .pageSheet and .modalPresentationStyle = .fullScreen. Tried other presentation styles but i keep getting "Could not get confirmation scene ID for" followed by the error "unknown".

I ended up finding a solution for UIKit through the hints from @jpdev001. The fix involves two key components:

Creating a hidden UIWindow that provides the necessary context for StoreKit operations. This window is kept at a lower window level but maintains key status. Wrapping the presenting view controller in a UINavigationController, which iOS 18.2's StoreKit requires for proper purchase flow.

I created a reusable protocol and utility function that handles this automatically. The function takes care of creating the hidden window, managing the navigation controller setup, and setting the requested presentation styles.

protocol Navigatable: UIViewController {
    var displayedWindow: UIWindow? { get set }
}

extension UIViewController {
    func presentWithStoreKitSupport<T: Navigatable>(
        from presentingView: UIViewController,
        viewController: T,
        presentationStyle: UIModalPresentationStyle,
        isModalInPresentation: Bool = false,
        transitionStyle: UIModalTransitionStyle? = nil,
        animated: Bool = true
    ) {
        // Create navigation controller
        let navigationController = UINavigationController(rootViewController: viewController)
        navigationController.isNavigationBarHidden = true
        navigationController.modalPresentationStyle = presentationStyle
        navigationController.isModalInPresentation = isModalInPresentation
        
        if let transitionStyle = transitionStyle {
            navigationController.modalTransitionStyle = transitionStyle
        }
        
        // Create StoreKit context window
        if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
            let purchaseWindow = UIWindow(windowScene: windowScene)
            purchaseWindow.isHidden = true
            purchaseWindow.windowLevel = .normal - 1
            purchaseWindow.rootViewController = UIViewController()
            purchaseWindow.makeKeyAndVisible()
            
            // Store window reference
            viewController.displayedWindow = purchaseWindow
            
            // Present the navigation controller
            presentingView.present(navigationController, animated: animated)
        }
    }
}

The transition to the respective view can be implemented the following way:

view.presentWithStoreKitSupport(
            from: view, // the main view
            viewController: navigatingView, // view we intend to navigate to
            presentationStyle: .fullScreen
)

Using this approach for the views that include in-app purchases fixed the issue for me. The solution also still works for older iOS Versions (tested with iOS 15 an 17). Also tested on multiple physical devices (iPhone 12 Pro and 15 Pro).

I solved the problem. Systems above iOS 18.2 need to call the purchase(confirmIn:options:) interface and pass a confirmIn parameter. See https://developer.apple.com/documentation/storekit/product/purchase(options:)#Discussion

Does anybody have a small-ish code snippet that reproduces this issue, or can point me in the right direction to write one?

Since iOS 18.0, I've encountered lots of StoreKit deprecated code on my projects, I recommend to set Minimum Deployment to iOS 18.0 and update any StoreKit deprecated code or upgrade everything to StoreKit 2

We are also seeing the issue in our StoreKit 2 implementation since updating to iOS 18.2. In our apps we have been able to narrow the issue down to when we present multiple UIWindows at the same time.

I'm guessing StoreKit is might be having issues determining which UIWindow should be used to present to StoreKit UI under those conditions.

We have reproduced the issues in a small sample project and filed a feedback to Apple with number: FB16117689

Solved my problem using the call @zbjumper shared.

Call purchase(confirmIn:options:) on UIKit projects

StoreKit 2 failure on tvOS 18.2
 
 
Q