iOS 17 StoreKit Examples
The new StoreKit views in iOS 17 make it a lot easier to add in-app purchases to your projects. There’s a simple gotcha that I ran into, though, and I wanted to document it.
The two main StoreKit views that ship with iOS 17 are StoreView
and SubscriptionStoreView
.
Their initializers both ask for IDs, but have different expectations about what constitutes an ID.
StoreView
StoreView
is the view that you would use for consumable and non-consumable products. It expects
the IDs of the products in a Collection, and the IDs are whatever you typed in as the “Product ID”.
For example:
SubscriptionStoreView
A SubscriptionStoreView
requires a group ID. You’ll give each of your subscription’s tiers a
product ID, but those aren’t used for querying the items. This group ID is autogenerated by
App Store Connect (or your StoreKit Test Configuration).
For example:
Example Project
I’ve also put together an example project to show all of this working together. It doesn’t need any configuration in App Store Connect, because I’m using a StoreKit Test Configuration.