how to use storekit 2
Generated on 8/12/2024
1 search
To use StoreKit 2, you can take advantage of several new features and improvements over the original StoreKit API. StoreKit 2 utilizes modern Swift language features, such as the Swift Async/Await pattern, to perform tasks like fetching product metadata, purchasing, and retrieving customer transaction history. This makes handling in-app purchases more efficient and straightforward.
Here are some key points about using StoreKit 2:
-
Async/Await Pattern: StoreKit 2 uses the Swift Async/Await pattern, which simplifies asynchronous code, making it easier to read and maintain.
-
Back Deployment: Thanks to the back-deployed attribute in Swift, StoreKit 2 allows you to access new App Store features even on devices with older operating systems.
-
Testing Enhancements: StoreKit 2 provides enhanced testing capabilities in Xcode, allowing you to test your in-app purchase flows more effectively. You can set up a StoreKit configuration file with your product metadata to test your app's behavior locally.
-
Custom UI: Starting in iOS 18, you can create custom control styles for your subscription store, using the same primitives that StoreKit uses for standard styles.
-
Deprecation of Original API: The original API for in-app purchases is deprecated starting with iOS 18. It's recommended to update your app to use StoreKit 2 to ensure you have access to the latest features and improvements.
For more detailed information, you can refer to the session What’s new in StoreKit and In-App Purchase (21:06) from WWDC 2024, which covers updates to StoreKit 2.
Implement App Store Offers
Learn how to engage customers with App Store Offers using App Store Connect, as well as the latest StoreKit features and APIs. Discover how you can set up win-back offers (a new way to re-engage previous subscribers) and generate offer codes for Mac apps. And find out how to test offers in sandbox and Xcode to make sure they work smoothly.
What’s new in StoreKit and In-App Purchase
Learn how to build and deliver even better purchase experiences using the App Store In-App Purchase system. We’ll demo new StoreKit views control styles and new APIs to improve your subscription customization, discuss new fields for transaction-level information, and explore new testability in Xcode. We’ll also review an important StoreKit deprecation.