iPhone - 应用内购买 : recording the purchase

标签 iphone memory storage in-app-purchase uninstallation

我已阅读 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/

相关文章:

iphone - 在 iPhone 后台下载

android - FCM 允许消息数据存储吗?

C++ 等效于 R 列表

java - 在android应用程序中保存相机拍摄的照片

带有 iPhone webview 的 Javascript 接口(interface)

iphone - 实现自定义 UIScrollView

iphone - 推送或弹出导航 Controller 时是否需要调整 UITableView 的大小 - IOS?

c 编程 shmat ( ) 权限被拒绝

memory - 编程时保留 STM32F4 内存

c++ - 使用复制构造函数复制动态分配的对象数组