Warm tip: This article is reproduced from serverfault.com, please click

swift-监听应用程序中的“促进应用内购买”事件

(swift - Listening for "Promoting Your In-App Purchases" event within the application)

发布于 2020-11-30 07:32:23

我们在应用程序的“ App Store”页面上提供并支持订阅产品,如下所示。

https://developer.apple.com/app-store/promoting-in-app-purchases/

当用户单击此处产品上的“订阅”按钮时,将打开该应用程序,并打开“ Apple购买”窗口。但是,在此流程中,我想添加一个家长控制而不打开Apple的购买窗口,如果成功,则将打开从Apple购买的窗口。

我的问题是;单击App Store中的“购买”按钮以打开应用程序时,如何收听此过程?

Questioner
enjektor0
Viewed
1
umitx 2020-11-30 15:48:56

你可以在SKPaymentTransactionObserver中使用以下方法,如果父控件的结果为true,则返回“ true”;否则,为false。

func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool {
    return true
}