Instance Method

loadProduct(withParameters:completionBlock:)

Loads a new product screen to display.

Declaration

func loadProduct(withParameters parameters: [String : Any], completionBlock block: ((Bool, Error?) -> Void)? = nil)

Parameters

parameters

A dictionary describing the content you want the view controller to display. See Product Dictionary Keys for keys that describe the product. See Ad Network Install Validation Keys for keys that describe an impression in an advertising campaign.

block

A block to be called when the product information has been loaded from the App Store. The completion block is called on the main thread and receives the following parameters:

result

true if the product information was successfully loaded, otherwise false.

error

If an error occurred, this object describes the error. If the product information was successfully loaded, this value is nil.

Discussion

For a seamless user experience, load the product information before presenting the SKStoreProductViewController view controller. However, if you load the product information while presenting the view controller, once loaded, the product data replaces the contents of the view controller.

See Also

Loading a New Product Screen

Offering Media for Sale in Your App

Allow users to purchase media in the App Store from within your app.

Product Dictionary Keys

Keys for identifying products and the tokens for affiliates and campaigns.