gpt4 book ai didi

ios - 使用 iCloud 恢复的不可再生应用内购买

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:40:17 25 4
gpt4 key购买 nike

我正在创建一个具有应用内购买功能的应用。我使用的是不可续订类型的订阅,但我必须支持在多个设备上恢复订阅。

在浏览了多个文档之后,我发现使用 iCloud 是实现它并为用户的多个设备提供订阅内容的更好方式。最后我决定实现以下设计:

  1. User explores the app
  2. Clicks on In-App purchase button option
  3. Check for iCloud availability

    1. iCloud Available :

      1. Continue with the purchase in usual way
    2. iCloud not available :

      1. Show Alert view : "Sign in to iCloud required to access the subscribed content on your other device", with options "OK" and "Continue anyway"

        1. Click OK :

          1. Remains on the same page
        2. Click "Continue anyway" :

          1. Continues with the purchase
          2. If already purchased and iCloud available, update the iCloud receipt
  4. On successful purchase, we get the transaction receipt. We will store this receipt in the iCloud (One time store in iCloud at the time of purchase) using key value storage and also in the user defaults

  5. Purchase successful.

  6. User launches the app from another device

  7. Check for any transaction receipt in the user defaults. If available, verify and proceed accordingly
  8. If no receipt available in user defaults, Check for iCloud availability

    1. iCloud Available :

      1. Check if any transaction receipt is available
      2. If available, verify the receipt. If the receipt is valid, provide subscribed content
      3. If not available, no action required and proceed normally
    2. iCloud not available :

      1. Show alert view : "Please sign into your iCloud account to enjoy your subscription content, if any" with options "OK"
      2. Inside the app, user switches on the option "subscribe to HD addition", will check for his subscription

问题:

  1. 用户在未登录 iCloud 的情况下购买应用
  2. 从另一台设备启动应用
  3. 他无法获得订阅的内容

考虑到所有测试场景,以完美方式处理此场景的唯一方法是将用户的 iCloud 凭据存储到用户默认设置中,我不确定是否可以这样做/是否推荐/是否允许。欢迎提出任何建议。

此外,我需要人们对上述步骤提出友好的意见,以确定它是否是继续进行的正确方法。请建议我是否可以改进它或有更好的方法。

最佳答案

我制作了一个应用程序,它使用 iCloud NSUbiquitousKeyValueStore(它有类似的选择器,如 NSUserDefaults)来同步 IAP 项目的消费类型。您可以在 Github 上查看存储库,例如 MKiCloudSync,看看它是如何工作的。

当使用 NSUbiquitousKeyValueStore 时,App 不需要知道 iDevices 的 iCloud 状态。在我的例子中,如果有人持有 2 台设备,设备 1 有 iCloud 登录但设备 2 没有,我将忽略设备 2。

关于ios - 使用 iCloud 恢复的不可再生应用内购买,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21643313/

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