为什么我的In App Purchase不购买产品?

时间:2015-06-29 16:03:31

标签: swift in-app-purchase

当我按下按钮解锁关卡时我正在调用此功能但是当我这样做时没有任何反应。它运行该功能,但它不会要求我的密码或其他任何东西。我做错了什么?

QMAKE_MAC_SDK = macosx10.9

1 个答案:

答案 0 :(得分:1)

From your code it looks like you haven't identified the asynchronous mode of in-app purchases. The whole process is done in steps, with various actors performing each step, and it cannot be described by the linear calls you have listed above.

In-app purchase is broadly made up of 3 distinct steps:

1 - Getting products from itunes store and displaying them on UI (Store UI which displays product titles, description, price in user-understandable way)

2 - Providing mechanism for user to purchase products from UI (IBActions that enable "Buy" action)

3 - Handling post-purchase (handle successful purchase by unlocking the product, handle failed purchase by displaying user-understandable error, and handle future restore for non-consumable products as they must not be purchased again as per the rules set by Apple)

This is what you must do. If you are looking for step by step tutorial on how to integrate IAP - here is my own tutorial to simplify what I wrote above.

If you need more efficient solution, here is video lecture series with SWIFT and Objective C. It also accompanies code samples for both.