Overview
- I am trying to write a unit test case to buy a storekit product.
SKTestSession.buyProduct(identifier: options:)throws the errorStoreKit.StoreKitError.notEntitled
Testcase Code
@Test func example() async throws {
let session = try SKTestSession(configurationFileNamed: "VehicleStore")
session.disableDialogs = true
session.clearTransactions()
do {
let transaction = try await session.buyProduct(identifier: "nonconsumable.car", options: [])
print(transaction)
} catch {
// Throws StoreKit.StoreKitError.notEntitled
print("Error: \(error)")
}
}
Storekit configuration file
Note
- In-App purchases capability is added
- StoreKit configuration file is used in testcase
Environment:
- macOS 26.5.2 (25F84)
- Xcode 26.6 (17F113)

