gpt4 book ai didi

swift - CloudKit 与沙箱用户同步测试

转载 作者:搜寻专家 更新时间:2023-11-01 07:24:23 24 4
gpt4 key购买 nike

我正在创建一个 Mac 应用程序,它具有作为应用程序内购买的非续订订阅。由于以下原因,我想将此数据同步到云端:

  • 我希望用户能够在他们所有的 Mac 上使用该应用
  • 应用内购买启用了一个小部件,因此该小部件需要访问此数据。
  • 根据 Apple 的文档,非续订订阅的恢复必须由应用程序通过某种注册/云同步来处理。

所以我决定实现一个 CloudKit 同步来存储以下数据:

  • 用户购买了哪个IAP产品(目前只有一个值,但将来可能会改变)
  • 购买发生在什么时间。

这是当用户进行应用内购买时我现在正在做的事情:

  1. 我验证收据
  2. 如果我找到任何 IAP 数据,我会将其同步到 CloudKit
  3. 我使用函数从 CloudKit 获取上述小部件的购买数据

问题 1:据我所知,所有应用内购买都包含在收据文件中,即使在删除并恢复它之后也是如此。我可以使用它,但是文档清楚地表明我不应该使用它。连论坛都不确定...你怎么看?

问题 2:在使用多个沙盒用户测试应用时,我注意到无论我使用哪个沙盒用户进行购买,当前登录的 iCloud 帐户(我的个人帐户)都会将收据数据同步到 CloudKit。为什么购买者(App Store)用户没有将数据获取到他们的私有(private)云数据库?我如何测试一切正常?我是否必须退出我的 iCloud 帐户才能进行此操作?

感谢您的宝贵时间:)

最佳答案

问题一:使用App Receipt恢复不可续订

来自 Apple 的文档:

Apple 关于非续订订阅的应用内购买是否保留在收据中的文档有相互矛盾的答案:

Yes (2016-05-11 检索):

表1-2订阅类型比较

Subscription type       Auto-renewable   Non-renewing    Free
Users can buy Multiple times Multiple times Once
Appears in the receipt Always Always Always
Synced across devices By the system By your app By the system
Restored By the system By your app By the system

No (2016-05-11 检索):

The in-app purchase receipt for a consumable product or non-renewing subscription is added to the receipt when the purchase is made. It is kept in the receipt until your app finishes that transaction. After that point, it is removed from the receipt the next time the receipt is updated—for example, when the user makes another purchase or if your app explicitly refreshes the receipt.

来自 Apple 的开发者论坛:

thread reporting the temporary (now fixed) loss of non-renewable subscriptions from the app receipt 中,一位 Apple 开发者技术支持工程师说:

I've queried the iTunes Production Support engineer who made the change - The "fix" to provide the history of non-renewing subscriptions in the application receipt is permanent. My interpretation is that permament means that if we make a change, we'll announce the change at a Developer Conference and announce the function to be deprecated for a period of time.

With regards to using iCloud as a means to restore non-renewing subscriptions, I've heard from my App Review contact - an application "can use iCloud to track the non-renewing subscriptions (NRS) but it can’t force the user to login prior to making the purchase. It has to be optional - that can can alert the user that iCloud is required to access the NRS content from their other iOS devices - and providing a way to register later, if users wish to have access to this content at a later time."

来源:https://forums.developer.apple.com/thread/22345#79067

您可以尝试刷新应用收据以恢复不可续订的订阅,但它有 broken before ,文档不明确,过去曾有 App Review 拒绝尝试此方法的应用程序的报告。


问题2:

CloudKit 始终在设置> iCloud 下使用当前的 iCloud 帐户。

App Store 购买使用在设置> iTunes 和 App Store 中配置的 Apple ID。

用户可以为 iCloud 和 iTunes 登录同一个 Apple ID,但不能保证。这是两个完全独立的设置。

关于swift - CloudKit 与沙箱用户同步测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37094396/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com