在哪里存储可下载的应用内购买? [英] where to store downloadable in-app purchases?

查看:84
本文介绍了在哪里存储可下载的应用内购买?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用已下载应用内购买。当下载内容时,我现在将其存储在文档目录中。但我知道Apple是挑剔的,可能会拒绝我的应用程序,因为可以恢复的内容不应存储在文档目录中,这意味着,将保存到icloud。

my app has downloadable in-app purchases. When the content is downloaded I am storing it right now on the documents directory. But I know Apple is nitpick and will probably reject my app because content that could be restored should not be stored on the documents directory, that means, will be saved to icloud.

我想过使用临时或缓存目录,但是当iOS需要空间时,这些目录都可以清空。

I thought of using temp or cache directories but these can be emptied any time when iOS needs space.

我应该在哪里保存?

推荐答案

Documents 目录只能用于用户生成的数据无法下载(包括包含用户可选设置等的潜在数据库),所以你是对的,如果你在那里存储可下载的内容,你可能会被拒绝。

The Documents directory can only be used for user generated data that cannot be downloaded (including potential databases that contain user selectable settings and similar), so you're right, you will probably be rejected if you store downloadable content there.

我已经完成的方法是将下载的数据存储在缓存中(正如你所说,当空间不足时可以随时清除),并存储一小块 Documents 中的数据,表示内容 Cache 。当 Documents 表示数据应该在那里而不是,我会通知用户由于空间问题iOS已自动删除内容,并提供给用户再次下载。

The way I've done it is to store the downloaded data in Cache (which as you say can be cleared at any time when space is low), and store a small piece of data in Documents that says that the content should be in Cache. When Documents says that the data should be there and it's not, I'll notify the user that the content has been automatically removed by iOS due to space issues, and offer the user to download it again.

这样,如果用户暂时不使用该内容,他可以将其设备上的空间重用于其他内容,并且仍然可以再次下载内容。就像我想要一个应用程序一样,如果我是用户:)

That way, if the user does not use the content for a while, he can reuse the space on his device for other things, and can still download the content again at will. Just like I'd want an app to work if I were the user :)

编辑:您可以将它们放入如果您需要它们始终持久,但请记住将它们标记为没有备份到iCloud 或者你很可能会得到同样的拒绝。

You can put them in Library if you need them to be always persistent, but remember to mark them as not backed up to iCloud or you'll most likely get the same rejection.

这篇关于在哪里存储可下载的应用内购买?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆