iOS Developer Library


StoreKit Framework Reference SKStoreProductViewController Class Reference

Deployment Target:

On This Page


A SKStoreProductViewController object presents a store that allows the user to purchase other media from the App Store. For example, your app might display the store to allow the user to purchase another app.

To display a store, create a new SKStoreProductViewController object and set its delegate. Then, present the view controller modally from another view controller in your app. Your delegate dismisses the view controller when the user completes the purchase.

To choose a specific product, call the loadProductWithParameters:completionBlock: method, passing the iTunes item identifier for the item you want to sell.

  • Loads a new product screen to display.



    func loadProductWithParameters(_ parameters: [String : AnyObject], completionBlock block: ((Bool, NSError?) -> Void)?)


    - (void)loadProductWithParameters:(NSDictionary<NSString *,id> *)parameters completionBlock:(void (^)(BOOL result, NSError *error))block



    A dictionary describing the content you want the view controller to display. See Product Dictionary Keys.


    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:


    YEStrue if the product information was successfully loaded, otherwise NOfalse.


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


    In most cases, you should load the product information and then present the view controller. However, if you load new product information while the view controller is presented, the contents of the view controller are replaced after the new product data is loaded.


    Available in iOS 6.0 and later.

  • Keys supported in the product dictionary.



    let SKStoreProductParameterITunesItemIdentifier: String let SKStoreProductParameterAffiliateToken: String let SKStoreProductParameterCampaignToken: String let SKStoreProductParameterProviderToken: String


    NSString * const SKStoreProductParameterITunesItemIdentifier; NSString * const SKStoreProductParameterAffiliateToken; NSString * const SKStoreProductParameterCampaignToken; NSString * const SKStoreProductParameterProviderToken;


    • SKStoreProductParameterITunesItemIdentifier


      The value of this identifier is an instance of NSNumber, representing the iTunes identifier for the item you want the store to display when the view controller is presented.

      To find a product’s iTunes identifier, go to and search for the product, then locate the iTunes identifier in the link URL. For example, the iTunes identifier for the iBooks app is 364709193.

      Available in iOS 6.0 and later.

    • SKStoreProductParameterAffiliateToken


      The value of this token is an instance of NSString, representing the affiliate identifier you wish to use for any purchase made through the view controller.

      You receive an affiliate identifier when you sign up for the Affiliate Program. The affiliate associated with this view controller is paid a commission for any items purchased using the controller.

      Learn more about the Affiliate Program at

      Available in iOS 8.0 and later.

    • SKStoreProductParameterCampaignToken


      The value of this token is an instance of NSString, representing an App Analytics campaign. This value can contain any 40-byte string.

      This token allows you to track the effectiveness of your Affiliate Program link and your App Analytics campaign. For more information about the Affiliate Program, see the Affiliate Program at For more information about iTunes Connect Analytics, see Viewing App Analytics in iTunes Connect Developer Guide.

      Available in iOS 8.0 and later.

    • SKStoreProductParameterProviderToken


      The value of this token is an instance of NSString, containing the provider token for the developer that created the app specified by the SKStoreProductParameterITunesItemIdentifier key.

      Use your own provider token when cross promoting your own apps. This token lets you track the effectiveness of the cross promotion effort separate from any affiliate campaign that shares the same campaign token.

      When promoting apps for other developers, use their provider token instead. In this case, the token lets the developer track the effectiveness of your App Analytics campaign for their apps.

      The key must be used in combination with your SKStoreProductParameterCampaignToken. For more information, see Viewing App Analytics in iTunes Connect Developer Guide.

      Available in iOS 8.3 and later.