How to consume a purchased item with In-App Purchase on iOS?

社会主义新天地 提交于 2020-01-01 05:38:06

问题


I had an app written on Android using In-App Billing(IAB), now I'm thinking of porting it to iOS.

Android's IAB has a concept of "consuming", as all purchased items are maintained by Google Play, not in the app:

In Version 3, all in-app products are managed. This means that the user's ownership of all in-app item purchases is maintained by Google Play, and your application can query the user's purchase information when needed. When the user successfully purchases an in-app product, that purchase is recorded in Google Play. Once an in-app product is purchased, it is considered to be "owned". In-app products in the "owned" state cannot be purchased from Google Play. You must send a consumption request for the "owned" in-app product before Google Play makes it available for purchase again. Consuming the in-app product reverts it to the "unowned" state, and discards the previous purchase data.

I went through the document of iOS In-App Purchase but didn't find similar ones. So how do we "consume" a purchased product on iOS?


回答1:


On iOS you are responsible for tracking the inventory of consumable items. You can do so with a local file store or you can use a server-based storage system. The latter is preferred, since it will allow you to track the user's inventory across multiple devices and restore their inventory if they delete and re-install your app, although this is not required by Apple's policies. From the In-App Purchase Guidelines

Consumable items are the one exception to the requirement that your content be available on all the user’s devices. Consumable items are digital items that are used up or disappear after use and can never be reused. Examples of consumable items include virtual poker chips, in-game ammunition, or virtual supplies such as construction materials.



来源:https://stackoverflow.com/questions/22599763/how-to-consume-a-purchased-item-with-in-app-purchase-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!