StoreKit testing in Xcode
StoreKit testing in Xcode allows you to test in-app purchases locally without setting up a sandbox account.
For this kind of testing, you need to:
- Create a product in Adapty and assign it a App Store product ID.
- In Xcode, create a local StoreKit configuration file and add a product to it. The product ID must be the same as App Store product ID in Adapty.
- Add the StoreKit configuration file to your build schema and build the app. Launch it on the emulator or on your device.
Should I use StoreKit testing in Xcode?
This way of testing is the most convenient if you are an app developer who wants to test the build on the go or to test different purchase scenarios using the Xcode features.
However, you must remember that this kind of testing is local, so no changes will appear on the Adapty dashboard. Before launching your app in the production environment, we recommend you test working with profiles using the sandbox environment.
You should use StoreKit testing if you want to:
- Test the purchase logic
- Reproduce different purchase scenarios using the Xcode tools (e.g., cancelled payment or refund)
- Test using the emulator
You shouldn't use StoreKit testing if you want to:
- Test profile-related logic
- See whether your actions in the app appear in the Adapty dashboard
- Share your app with non-development teams for testing
Step 1. Create a StoreKit configuration file
To create a StoreKit configuration file, in Xcode:
- Click File > New > File from template. Then, select StoreKit Configuration File and click Next.

-
Give it a name. Then, depending on whether you have the products in App Store Connect already:
- Select Sync this file with an app in App Store Connect: To create a configuration file that will contain all your App Store Connect products, so you can test them locally.
- Don't select Sync this file with an app in App Store Connect: To create an empty configuration file where you will need to add products manually.
Click Next.

- Don't add your app as a target. Just proceed. If you are working with products synced from App Store Connect, go to Step 2.
- If your products are not synced from App Store Connect, click + at the bottom left and select a product type.

- Enter a subscription group name and click Next.

- Enter a reference name. In the Product ID field, enter the App Store product ID of your product in Adapty.

- Configure pricing, offer, and other product settings in the configuration file. Or, add more products to it.

Step 2. Add the configuration file to the build scheme
To build the app using this configuration file, you need to add it to a build scheme. The best practice is to separate testing and production schemes, so we suggest you create a new scheme for testing:
- At the top, click your app name and select New scheme.

- Enter a name for the scheme and click OK.

- Click the app name again and select Edit scheme. IN the StoreKit configuration, select your local configuration file, so it will be used on build.

Step 3. Build & test
Now, you can build the app and test in-app purchases without connecting to the App Store backend. You can purchase products and get access levels locally. These changes won't be reflected in the Adapty dashboard, but you can still test unlocking paid features locally.
Read more about other features available with StoreKit testing in Xcode.
