Fetching Product Information from the App Store

Retrieve up-to-date information about the products for sale in your app to display to the user.


To make sure your users see only products that are actually available for them to purchase, query the App Store before displaying your app’s store UI. You will need a list of all of your app's product identifiers; for more on retrieving this list, see Loading In-App Product Identifiers.

Request Product Information

To query the App Store, create a products request (SKProductsRequest) and initialize it with a list of your product identifiers. Be sure to keep a strong reference to the request object; otherwise, the system might deallocate the request before it can complete.

The products request retrieves information about valid products, along with a list of the invalid product identifiers, and then calls its delegate to process the result. The delegate must implement the SKProductsRequestDelegate protocol to handle the response from the App Store. Here's a simple implementation of both pieces of code:

// Keep a strong reference to the product request.
var request: SKProductsRequest!

func validate(productIdentifiers: [String]) {
     let productIdentifiers = Set(productIdentifiers)

     request = SKProductsRequest(productIdentifiers: productIdentifiers)
     request.delegate = self 

var products = [SKProduct]()
// SKProductsRequestDelegate protocol method.
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
    if !response.products.isEmpty {
       products = response.products
       // Custom method.

    for invalidIdentifier in response.invalidProductIdentifiers {
       // Handle any invalid product identifiers as appropriate.

Keep a reference to the array of product objects (SKProduct) returned to the delegate since you will need the corresponding product object to create a payment request when the user purchases a product. If the list of products sold on your app is subject to change, such as when you add or remove a product from sale, consider creating a custom class that encapsulates a reference to the product object along with other information, such as pictures or description text that you fetch from your server. For more information on payment requests, see Requesting a Payment from the App Store.

Troubleshoot Invalid Product IDs

Invalid product IDs in the App Store response to your products request usually indicate an error in your app’s list of product IDs. Invalid product IDs could also mean you configured the product improperly in App Store Connect. Actionable UI and insightful logging can help you resolve this type of issue more easily:

  • In production builds, fail gracefully by displaying the rest of your app’s store UI and omitting the invalid product.

  • In development builds, display an error to call attention to the issue.

  • In both production and development builds, use NSLog to write a message to the console so you have a record of the invalid identifier.

  • If your app fetched the list from your server, you could also define a logging mechanism to let your app send the list of invalid identifiers back to your server.

See Also

Product Information

Loading In-App Product Identifiers

Load the unique identifiers for your in-app products in order to retrieve product information from the App Store.

class SKProductsRequest

An object that can retrieve localized information from the App Store about a specified list of products.

class SKProductsResponse

An App Store response to a request for information about a list of products.

class SKProduct

Information about a product previously registered in App Store Connect.