2

我正在阅读这个应用内购买教程:

http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial

为了进行购买,我们需要执行以下操作:

SKProduct* product = ...;
SKPayment* payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addPayment:payment];

看起来我们需要一个实例SKProduct来传递给addPayment:方法。这是否意味着每次用户打开我们的应用时,我们都需要从应用商店获取我们的应用提供的产品列表?

就我而言,我有一个硬编码产品标识符列表。我想知道人们是否会SKProduct一次获取实例列表,然后将它们缓存到磁盘。然后,在您为应用添加更多产品之前,无需重新获取。不过,我猜想像本地化价格这样的动态属性会阻止缓存。

那么每次应用程序运行时重新获取产品列表是否很典型?

谢谢

4

2 回答 2

2

No it's not mandatory to make product request each time when application launches. It just depends on application requirement.Suppose in Your Application First Screen is Something Like The Store SCreen Where You display the Item To be sold. In that case You should make the Product request to the Itunes Store So that You can display The Most updated Information Corresponding to Products each time when application launches.

Suppose If in your Application you display The Products List on clicking of some Store Button(Say any Button on clicking you load Store Content). then in that case you should make the Product request at that Time and display these product on screen. And As clicking on any one of them(product) you can pass that SKProduct to the SKPaymentQueue.And In that case no need to make The Product request to the Itunes Store each time when application launches.

So here I Would Say You Firstly Need To think About Your Application requirement. I hope It may help you.

于 2013-01-01T19:17:16.683 回答
1

在我自己的应用程序中,每次用户进入我的应用程序中的“商店”屏幕时,我都会获取 SKProducts,而不是每次运行应用程序时。如果用户此时没有购买任何东西的意图,则无需获取产品。等到用户选择查看有关可以在您的应用中进行哪些应用内购买的详细信息。

于 2013-01-01T17:01:12.140 回答