Retrieving Product Information
When your application is ready to display a store to the user, it must populate its user interface with information from the App Store. This chapter details how to request product details from the App Store.
Sending Requests to the App Store
Store Kit provides a common mechanism to request information from the App Store. Your application creates and initializes a request object, attaches a delegate to it, and starts the request. Starting a request transmits it to the App Store, where it is processed. When the App Store processes the request, the request’s delegate is called asynchronously to deliver the results to your application. Figure 2-1 shows the request model.
If your application quits while a request is pending, your application needs to resend it.
SKRequest is an abstract base class for requests sent to the store.
SKRequestDelegate is a protocol that your application implements to handle requests that completed successfully and requests that failed because of an error.
Requesting Information About Products
Your application uses a products request to retrieve localized information about a product. Your application creates a request that contains a list of product identifier strings. As described earlier, your application might embed product identifiers inside your application or it might retrieve the identifiers from an external server.
When you start the products request, the product identifier strings are transmitted to the App Store. The App Store responds with the localized information you previously entered in iTunes Connect. You use these details to populate the user interface of your store. Figure 2-2 shows a products request.
SKProductsRequest object is created with a list of product identifier strings for the products you want to display in your store.
SKProductsRequestDelegate protocol is implemented by an object in your application to receive the response from the store. It receives the response asynchronously when the request is successfully processed.
SKProductsResponse object contains a
SKProduct object for each valid product identifier in the original request as well as a list of the product identifiers that were not recognized by the store. The store might not recognize the identifier for a number of reasons; it might be misspelled, marked unavailable for sale, or changes you have made in iTunes Connect have not propagated to all of the App Store servers.
SKProduct object provides localized information about a product you’ve registered with the App Store.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)