How to setup storekit 2

Generated on 8/8/2024

1 search

To set up StoreKit 2, you can follow the steps outlined in the session "What’s new in StoreKit and In-App Purchase" from WWDC 2024. Here are the key points:

  1. Set Up a StoreKit Configuration File:

    • This is necessary to get the in-app purchase UI working with Xcode previews.
    • For a detailed explanation on how to set up a StoreKit configuration file in Xcode, you can refer to previous sessions like "What's new in StoreKit testing" from WWDC 2022 and "Introducing StoreKit testing in Xcode" from WWDC 2020.
  2. Use Swift Async/Await Pattern:

    • StoreKit 2 leverages modern language features like the Swift Async/Await pattern to perform tasks such as fetching product metadata, purchasing, and retrieving customer transaction history.
  3. Back Deployment:

    • Thanks to the back-deployed attribute in Swift, StoreKit 2 allows you to access new App Store features even when your app is installed on a device with an older operating system.
  4. Testing in Xcode:

    • StoreKit testing in Xcode is the best way to ensure your in-app purchase experience is optimal. You can defer configuring your products in App Store Connect until you've made sure your app behaves as expected.
    • New in Xcode 16, you can test your app's privacy policy and license agreement locally, and also test localizations for your subscription groups' display names.

For more detailed information, you can watch the session What’s new in StoreKit and In-App Purchase starting at 03:12.