iOS Developer Library

Developer

StoreKit Framework Reference SKStoreProductViewController Class Reference

Options
Deployment Target:

On This Page
Language:

SKStoreProductViewController

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. More...

Inheritance


Import Statement


import StoreKit @import StoreKit;

Availability


Available in iOS 6.0 and later.
  • Loads a new product screen to display.

    Declaration

    Swift

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

    Objective-C

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

    Parameters

    parameters

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

    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

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

    error

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

    Discussion

    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.

    Import Statement

    import StoreKit

    Availability

    Available in iOS 6.0 and later.

  • Keys supported in the product dictionary.

    Declaration

    Swift

    let SKStoreProductParameterITunesItemIdentifier: NSString! let SKStoreProductParameterAffiliateToken: NSString! let SKStoreProductParameterCampaignToken: NSString!

    Objective-C

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

    Constants

    • SKStoreProductParameterITunesItemIdentifier

      SKStoreProductParameterITunesItemIdentifier

      The value associated with this key 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 linkmaker.itunes.apple.com 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

      SKStoreProductParameterAffiliateToken

      The value associated with this key is an instance of NSString, 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 Link Maker 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.

      Learn more about the Affiliate Program at https://apple.com/itunes/affiliates.

      Available in iOS 8.0 and later.

    • SKStoreProductParameterCampaignToken

      SKStoreProductParameterCampaignToken

      The value associated with this key is an instance of NSString, representing any 40 byte string of text for monitoring and measuring the effectiveness of your link. By using a campaign token, you will see all clicks and sales related to that campaign in the affiliate program reporting dashboard.

      Available in iOS 8.0 and later.

    Import Statement