SKTestSession.setSimulatedError() not working for .loadProducts API in iOS 26.2

Description

SKTestSession.setSimulatedError() does not throw the configured error when testing StoreKit with the .loadProducts API in iOS 26.2. The simulated error is ignored, and products load successfully instead.

Environment

Expected Behavior

After calling session.setSimulatedError(.generic(.notAvailableInStorefront), forAPI: .loadProducts), the subsequent call to Product.products(for:) should throw StoreKitError.notAvailableInStorefront.

Actual Behavior

The error is not thrown. Products load successfully as if setSimulatedError() was never called.

Steps to Reproduce

  1. Create an SKTestSession with a StoreKit configuration file
  2. Call session.setSimulatedError(.generic(.notAvailableInStorefront), forAPI: .loadProducts)
  3. Call Product.products(for:) with a valid product ID
  4. Observe that no error is thrown and the product loads successfully

Sample Code

import StoreKitTest
import Testing

struct SKDemoTests {

    let productID: String = "plus.standard"

    @Test
    func testSimulatedErrorForLoadProducts() async throws {
        let storeKitConfigURL = try Self.getStoreKitConfigurationURL()
        let session = try SKTestSession(contentsOf: storeKitConfigURL)

        try await session.setSimulatedError(
            .generic(.notAvailableInStorefront),
            forAPI: .loadProducts
        )

        try await confirmation("StoreKitError throw") { throwStoreKitError in
            do {
                _ = try await Self.execute(productID: productID)
            } catch let error as StoreKitError {
                guard case StoreKitError.notAvailableInStorefront = error else {
                    throw error
                }

                throwStoreKitError()
            } catch {
                Issue.record(
                    "Expect StoreKitError. Error: \(error.localizedDescription)"
                )
            }
        }

        #expect(session.allTransactions().isEmpty)
    }

    static func execute(productID: String) async throws {
        guard
            let product = try await Product.products(for: [productID]).first(
                where: { $0.id == productID })
        else {
            throw NSError(
                domain: "SKDemoTests",
                code: 404,
                userInfo: [NSLocalizedDescriptionKey: "Product not found for ID: \(productID)"]
            )
        }
        _ = product
    }

    static func getStoreKitConfigurationURL() throws -> URL {
        guard
            let bundle = Bundle(identifier: "your.bundle.identifier"),
            let url = bundle.url(forResource: "Products", withExtension: "storekit")
        else {
            fatalError("StoreKit configuration not found")
        }
        return url
    }
}

Test Result

The test fails because the expected StoreKitError.notAvailableInStorefront is never thrown.

Question

Is this a known issue in iOS 26.2 / Xcode 26.2 beta 2, or is there a different approach required for simulating errors with SKTestSession in this version? Any guidance would be appreciated.

Feedback Assistant report: FB21110809

SKTestSession.setSimulatedError() not working for .loadProducts API in iOS 26.2
 
 
Q