如何在 iOS / StoreKit 2 中通过订阅从付费版本更改为免费版本

问题描述 投票:0回答:2

多年来我在应用程序商店中已有一个应用程序。用户必须付费才能下载该应用程序。现在我想通过实施应用内购买转向“免费增值”模式。 我希望对我的应用程序的先前购买者公平。 我搜索并阅读了很多关于这个主题的内容,它仍然让我感到害怕,主要是因为它总是归结为

解析

原始交易收据和“解析”加密的东西,例如“原始应用程序版本字段” ...我非常希望,新的 StoreKit 2 为这个非常常见的问题提供更多选项,但找不到它。 所以我在这里问:在

StoreKit 2

中是否有一种更简单的方法可以从原始购买中检索更多“可读”数据? 任何提示将不胜感激。👍🏻

storekit swiftystorekit
2个回答
1
投票

使用原生API支持部分功能

如果您的应用依赖于以下任何功能,您可能需要使用原始的应用内购买 API:

    为批量购买计划 (VPP) 提供支持。有关更多信息,请参阅设备管理。
  • 提供应用程序预订。
  • 您的应用程序从
  • 高级模式更改为免费增值模式,反之亦然。 对现有和遗留应用程序使用原始 API。

https://developer.apple.com/documentation/storekit/choosing_a_storekit_api_for_in-app_purchase

因此,显然,至少到目前为止,在 iOS 15 中还无法使用 StoreKit 2 检索该信息。


0
投票

do { // Get the appTransaction. let shared = try await AppTransaction.shared if case .verified(let appTransaction) = shared { // Hard-code the major version number in which the app's business model changed. let newBusinessModelMajorVersion = "2" // Get the major version number of the version the customer originally purchased. let versionComponents = appTransaction.originalAppVersion.split(separator: ".") let originalMajorVersion = versionComponents[0] if originalMajorVersion < newBusinessModelMajorVersion { // This customer purchased the app before the business model changed. // Deliver content that they're entitled to based on their app purchase. } else { // This customer purchased the app after the business model changed. } } } catch { // Handle errors. } // Iterate through any other products the customer purchased. for await result in Transaction.currentEntitlements { if case .verified(let transaction) = result { // Deliver the content based on the customer's current entitlements. } }

https://developer.apple.com/documentation/storekit/apptransaction/3954447-originalappversion

© www.soinside.com 2019 - 2024. All rights reserved.