iOS currentEntitlementIOS

Get current StoreKit 2 entitlement for a product (iOS 15+, macOS 14+).

Uses Product.currentEntitlements where available and otherwise filters Transaction.currentEntitlements by SKU. This avoids StoreKit's deprecated singular Product.currentEntitlement property. Generic Advanced Commerce SKUs can yield multiple current transactions, so OpenIAP returns the latest verified entitlement by purchase date and transaction ID. See the Apple StoreKit reference.

Signature

swift
func currentEntitlementIOS(sku: String) async throws -> PurchaseIOS?

Parameters#

  • sku (required, string) — Product identifier.

Returns#

Promise<PurchaseIOS | null> — iOS purchase shape, or null if the SKU has no matching transaction.

Example

swift
let entitlement = try await OpenIapModule.shared.currentEntitlementIOS(sku: "com.app.premium")