gpt4 book ai didi

iPhone - 应用内购买 : recording the purchase

转载 作者:行者123 更新时间:2023-12-03 20:34:06 24 4
gpt4 key购买 nike

我已阅读 here以及其他地方的以下内容:

Finally, after providing the feature, you should “remember” that the user has purchased the app. Apple’s recommended way is to use NSUserDefaults, the same way you store your settings.

但是...如果我没记错的话,当您从手机(但不是从 iTunes)删除应用程序时,如果您稍后从 iTunes 恢复它,首选项将被删除并恢复为默认值。是对的吗 ?那么,如果用户从手机中删除该应用程序,并在几周后从 iTunes 库中重新安装该应用程序,那么我的说法是否正确,其应用内购买将会丢失?

最佳答案

是的,你是对的。当用户删除应用程序时,NSUserDefaults 也会被删除。但是,应用程序商店有一个方便的恢复购买功能,您可以在其中请求告知苹果为当前用户记录的购买情况。

似乎没有一个好的方法来检测是否需要恢复购买(至少从我在这里看到的),大多数开发人员似乎只是提供一个手动启动恢复过程的按钮。

还有一种替代方案,即将用户购买的内容存储在钥匙串(keychain)中,(至少现在)卸载应用程序时不会删除钥匙串(keychain)。我已经确认 iOS 4.3 上就是这种情况 - 尽管它可能不会永远保持这种状态。

这里有一些 sample code that demonstrates both restore purchases, and using the keychain to save purchases

关于iPhone - 应用内购买 : recording the purchase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5422639/

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