菜鸟教程小白 发表于 2022-12-11 19:26:46

ios - Swift 应用内购买非消耗品


                                            <p><p>我正在开发非消耗品的 IAP 功能(去除广告)。
我为所有操作创建了一个助手,一切正常。</p>

<p>当用户购买/恢复购买时,我设置了这个:</p>

<pre><code>let save = UserDefaults.standard
save.set(true, forKey: &#34;Purchase&#34;)
save.synchronize()
</code></pre>

<p>只要用户从不删除应用程序,它就可以正常工作。</p>

<p>我想知道...
有没有办法知道用户(删除并重新安装应用程序后)是否已经进行了购买?那么要将按钮的标题从“购买”更改为“恢复”?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>对于每个应用,Apple 要求您包含“恢复购买”按钮。这正是您面临的问题。它将为每个先前购买的 IAP 重新创建 <code>SKPaymentTransaction</code>,并为当前在 App Store 登录的 iCloud 帐户以“已恢复”状态,并放入 <code>SKPaymentQueue</code>。 <a href="https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html" rel="noreferrer noopener nofollow">Read more...</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - Swift 应用内购买非消耗品,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/47790873/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/47790873/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - Swift 应用内购买非消耗品