Contents

SKStoreProductViewController

A view controller that provides a page where customers can purchase media from the App Store.

Declaration

@MainActor class SKStoreProductViewController

Mentioned in

Overview

To display a store for customers to purchase media from the App Store, follow these steps:

  1. Create an SKStoreProductViewController object and set its delegate.

  2. Indicate a specific product to sell by passing its iTunes item identifier to the loadProduct(withParameters:completionBlock:) method.

  3. Present the view controller modally from another view controller in your app. Your delegate dismisses the view controller when the customer completes the purchase.

Present the SKStoreProductViewController object immediately when someone triggers an interaction, such as tapping a Buy button. Load the product information before presenting the view controller to ensure a seamless user experience.

This class ignores modalPresentationStyle settings, and those settings have no impact on the sheet’s presentation.

To recommend another app without displaying a full product page, and to recommend an App Clip’s corresponding app from within the App Clip, use SKOverlay.

Prevent exceptions

The SKStoreProductViewController class doesn’t support subclassing or embedding, and must be used as-is.

This class throws the following runtime exceptions:

SKUnsupportedClassException

Occurs if the app attempts to instantiate a subclass of SKStoreProductViewController.

SKUnsupportedPresentationException

Occurs if the app attempts to use an unsupported presentation mode for SKStoreProductViewController, such as embedding it as a subview controller or attempting to use it in a popover.

Topics

Setting a delegate

Loading a new product screen

See Also

Recommendations