应用内购买:滞留在paymentWithProductIdentifiers - 已弃用 [英] In-App Purchases: Stuck at paymentWithProductIdentifiers - which is deprecated
问题描述
我很难设置我的应用内购买。
I am stuck with setting up my in-app purchases.
我无法做到这一点:
SKPayment *paymentRequest = [SKPayment paymentWithProduct: @"co.za.nideo.100shotsbuybeer"];
我是从
SKPayment *paymentRequest = [SKPayment paymentWithProductIdentifiers: @"co.za.nideo.100shotsbuybeer"];
但这似乎已被弃用。如何让第一段代码工作?
but this seems to be deprecated. How can I get the first piece of code to work?
它似乎是一个SKProduct但我不知道如何创建/ init这样的对象。
It seems to nee a SKProduct but I don't know how to create/init such an object.
推荐答案
根据StoreKit文档和[1],您必须:
According to the StoreKit docs and [1] you'd have to:
- 使用您的商品标识符(
initWithProductIdentifiers:
)创建SKProductsRequest
- 将自己设置为
委托
- 将此请求发送给Apple(
start
方法) - 响应将调用您的代理
productsRequest:didReceiveResponse:
其中包含SKProductsResponse
object - 您从
产品中提取
属性并显示它们,保存对象以供进一步购买。SKProduct
对象
- Create an
SKProductsRequest
with your product identifiers (initWithProductIdentifiers:
) - Set yourself as the
delegate
- Send this request to Apple (
start
method) - The Response will call your delegates
productsRequest:didReceiveResponse:
which contains anSKProductsResponse
object - You extract the
SKProduct
objects from theproducts
property and display them, saving the objects for further purchase.
这似乎符合重要提示:在允许用户购买之前,您必须提出特定产品标识符的产品请求那个产品。从App Store检索产品信息可确保您使用有效的产品标识符来标记可在iTunes Connect中标记的产品。来自[1]
This seems in line with Important: You must make a product request for a particular product identifier before allowing the user to purchase that product. Retrieving product information from the App Store ensures that you are using a valid product identifier for a product you have marked available for sale in iTunes Connect. from [1]
这篇关于应用内购买:滞留在paymentWithProductIdentifiers - 已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!