分类
iOS开发

使用StoreKit2不再需要恢复购买按钮,但是为了审核你还需要放一个【AppStore审核手记】

昨天我提交了一个新App,2023年我的计划就是开发一系列的小App试图在独立开发领域有一份收入。但是今天一早就发现被拒绝了。

理由是:

Guideline 3.1.1 – Business – Payments – In-App Purchase

We found that your app offers in-app purchases that can be restored but does not include a “Restore Purchases” feature to allow users to restore the previously purchased in-app purchases, as specified in the “Restoring Purchase Products” section of the In-App Purchase Programming Guide:

“Users restore transactions to maintain access to content they’ve already purchased. For example, when they upgrade to a new phone, they don’t lose all of the items they purchased on the old phone. Include some mechanism in your app to let the user restore their purchases, such as a Restore Purchases button.”

Next Steps

To restore previously purchased in-app purchase products, it would be appropriate to provide a “Restore” button and initiate the restore process when the “Restore” button is tapped by the user. Note that automatically restoring purchases on launch will not resolve this issue.

这段大概可以翻译为:

准则3.1.1 – 业务 – 支付 – 应用内购买

我们发现你的应用程序提供了可以恢复的应用内购买,但不包括 “恢复购买 “功能,以允许用户恢复之前购买的应用内购买,如应用内购买程序指南的 “恢复购买产品 “部分所规定的。

“用户恢复交易以保持对他们已经购买的内容的访问。例如,当他们升级到一个新的手机时,他们不会失去他们在旧手机上购买的所有物品。在你的应用程序中包括一些机制,让用户恢复他们的购买,如恢复购买按钮。”

接下来的步骤

为了恢复以前购买的应用内产品,应该提供一个 “恢复 “按钮,并在用户点击 “恢复 “按钮时启动恢复程序。请注意,启动时自动恢复购买的产品不会解决这个问题。

意思就是,我提供了一个应用内购买功能(付费用户),但是没有提供恢复购买按钮。

我当时就很奇怪,因为我用的是StoreKit2,我记得学习这套新API的原因有两个大点,第一个就是这套新API更简洁,更好用。第二就是,不需要恢复购买的流程了,自动会保持与AppStore购买记录的同步。

我找来当时让我选择了Storekit2的WWDC官方视频“Meet StoreKit 2 | 10114 | WWDC2021”,里面明确的说了,

So, all of this means that users won’t need to restore completed transactions when your app is reinstalled or downloaded on a new device. Everything should automatically be fetched by StoreKit and stay up to date. 

因此,所有这些都意味着,当你的应用程序被重新安装或下载到新设备上时,用户将不需要恢复已完成的交易。 一切都应该由StoreKit自动获取,并保持最新状态。 

结果,我没注意的是,这句以后,他还说了一句,

But people use their Apple devices in millions of ways in millions of places. In the rare case that a user thinks they should have a transaction but you don’t see it, you can use the App Store sync API. This immediately resynchronizes all StoreKit 2 transactions. This is a replacement for the restoreCompletedTransactions API,and you should provide UI in your app that allows users to initiate the sync. However, thanks to StoreKit 2’s automatic synchronization, it should be very rare that a user needs to initiate a sync manually. 

但人们在数百万个地方以数百万种方式使用他们的苹果设备。 在罕见的情况下,如果用户认为他们应该有一个交易,但你没有看到它,你可以使用App Store的sync API。 这将立即重新同步所有StoreKit 2交易。 这是对 restoreCompletedTransactions API 的替代,你应该在你的应用程序中提供允许用户启动同步的用户界面。 然而,由于StoreKit 2的自动同步功能,用户需要手动启动同步的情况应该非常少。 

也就是说,虽然,基本上用不上恢复购买按钮,但是我们还是需要提供一个恢复购买按钮,来同步Appstore的购买记录。

而且,审核Guideline也没变,还是要求提供恢复购买按钮。

那能怎么办呢?那就加吧。

在UI的底部加上一段代码,倒是不复杂:

Button {
    Task {
        do {
            try await AppStore.sync()
        } catch {
            print(error)
        }
    }
} label: {
    Text("Restore Purchases")
}

我本来觉得这个按钮就是蠢的要死。你在别的网络服务买个账号,需要有个按钮明确的恢复购买么?不都是网络化的,有信号就自动更新的东西么。唉,本以为StoreKit2以后就不用放这个愚蠢的按钮,看来还是需要,放就放吧。

我也能理解苹果遇到的问题,总有网络问题,或者用户觉得自己买过,也许是糊涂了,给他一个按钮,让他可以手动恢复,可能会让用户更安心吧。唉。

打赏

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据