0
votes

I'm trying to implement in-app purchase.

Already I registered a few in-app purchases in iTunes Connect. I think it's enough for an app to figure out in-app purchases. But SKProductsRequest should be initialized with product IDs.

[[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifiers]];

SKProductRequest can know that names, prices and product IDs of in-app purchases When it communicates with Apple server even without initialization by productIdentifiers. right?

So, I don't understand why SKProductsRequest needs product IDs. Can I use it without product IDs for retrieving in-app purchases content from Apple server?

1

1 Answers

3
votes

You need to provide a set of valid product identifiers to the initWithProductIdentifiers call because that is what the API specifies.

To use an SKProductsRequest object, you initialize it with a list of product identifier strings, attach a delegate, and then call the request’s start method. When the request completes, your delegate receives an SKProductsResponse object.

Why the API was designed this way is a matter of opinion (aside from the people at Apple who know why they designed it that way). My opinion is that by requiring the app to submit the set of product identifiers it avoid problems that may occur in the following situation:

  1. An app is released with support for in-app purchase
  2. Subsequent to the release a new in-app purchase is added to iTunesConnect and approved
  3. The app displays a purchase interface that automatically displays all approved in-app purchases
  4. User purchases the new product, but the app is unable to fulfil this purchase because it doesn't know what the purchase is (The app was released before the product was defined)
  5. User complains to Apple who issue a refund as the app did not deliver content/feature or User is annoyed because they didn't get their content/feature but do not complain and get a refund but have a poor experience of in-app purchasing