0

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?

bureaucoconut
  • 733
  • 7
  • 15

1 Answers1

3

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
Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • i can see why your answer got awarded the correct one.. but without any vote ups – abbood Jun 10 '15 at 10:51
  • actually here is my question: i simply need to know the users store's country so that i can include it in my search in the apple itunes search api.. so in other words.. i *don't* have any in app purchases.. i just wanna use [this](http://stackoverflow.com/a/9625922/766570) trick to find out.. – abbood Jun 10 '15 at 10:57
  • so the question is: i'm assuming the store-kit framework *won't* work unless if in intunes connect i _claim_ that i have in app purchases (which i don't).. but then my app will be rejected b/c im being such a wise guy – abbood Jun 10 '15 at 10:58
  • Yes, that sounds about right. In-app purchases need to be approved just like apps do - and if you don't actually have the ability to purchase something I guess they will reject it. – Paulw11 Jun 10 '15 at 11:11