StoreKit2: Product.currentEntitlement vs. Transaction.currentEntitlements

373 views Asked by At

I'm migrating from StoreKit to StoreKit2 and wondering, if there's a difference between these two following code-snippets. And of course, which one is preferred and why it is the preferred way.

    for await entitlement in Transaction.currentEntitlements {
        // Do something with the entitlement
    }
    

or

    // `myProducts` contains a list of all products, that were received by call to Products.products(...) before.
    for product in myProducts {
        let entitlement = await product.currentEntitlement
        // Do something with the entitlement
    }

Any thoughts? Both seem to work in sandbox, but what about production?

Note: I have only auto-renewable subscriptions as products in my App.

0

There are 0 answers