- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我有一个应用程序,可让您下载“模块”,以扩展您的应用程序使用范围。
当用户下载模块时,我从服务器获取一个 ZIP 文件并将其解压缩到他的 Caches 文件夹中。 (每个 zip 的大小都可以从 60k 到 2MB 不等)。
不幸的是,有超过 300 模块可用,许多用户至少将其中的 50-60 个下载到他们的设备上。
最近,我收到很多关于模块从用户设备上消失的投诉,所以我做了一些调查,并在 Apple 的文档中发现了以下措辞。
iOS will delete your files from the Caches directory when necessary, so your app will need to degrade gracefully if it's data files are deleted.
还有以下文章进一步解释了这种情况: http://iphoneincubator.com/blog/data-management/local-file-storage-in-ios-5
我的问题是,我无法优雅地降级,因为我无法自动让用户下载这么多模块。这可能需要几个小时,具体取决于互联网连接和模块的大小。
所以我有几个问题:
这是 Apple 的一个非常令人沮丧的举动,我真的看不到出路。真的很想听听您的一些想法。
最佳答案
编辑:经过一些测试,这似乎工作得很好并且没有被清除。
这还没有 100% 得到证实,但它在我们的基本测试中运行良好(我会在它们出现时发布更全面的结果)。将数据保存到应用程序的“应用程序支持”文件夹似乎可以解决这些问题,因为该文件夹未被清除。
docs状态:
Use the Application Support directory constant NSApplicationSupportDirectory, appending your
<bundle_ID>
for: Resource and data files that your app creates and manages for the user. You might use this directory to store app state information, computed or downloaded data, or even user created data that you manage on behalf of the user / Autosave files.`
您可以按如下方式进入该文件夹(请注意按照苹果官方文档的要求附加包 ID):
[[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]]
希望这对任何人都有帮助,正如我所说,我会在周末发布更全面的测试结果。
编辑 2:添加此行以防止从应用程序支持同步临时内容非常重要。我在 applicationDidFinishLaunching 的末尾使用它:
[[NSURL URLWithString:NSApplicationSupportDir] setResourceValue:@(YES) forKey:NSURLIsExcludedFromBackupKey error:nil];
关于ios - 在 iOS 上自动清除(清空/清除)缓存文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11452145/
我有一个 QVariantList。我怎样才能清空它。 我试过了 myList.clear() 和 myList.empty(); 但运气不好。有什么想法吗? 最佳答案 A QVariantList只
我在创建一个空的 JTabbedPane 时遇到问题,其中在 GUI 上唯一可见的部分是选项卡行。 每次我添加一个带有“空”组件的新选项卡时,JTabbedPane 的高度都会增加,但这是为什么呢?
我有一个简单的 Windows 窗体,其中包含一个名为 list 的 ListView 对象。在窗体上,一个按钮使我能够在单击 list.Items.Clear() 时清空列表。这很好用。 现在我有一
最近遇到一点麻烦事,新安装的PHPwind6.0正式版社区在导入之前的会员帐号资料时,发现很多会员的mail地址貌似胡乱填写的,之前的PHPwind5.5版本没有开启mail地址验证功能,所以估计很
我在 Visual Basic for Applications 中遇到一个 Collection 对象问题(我在 Excel 中使用它) 我有这段代码试图清空一个我必须重新使用的 Collectio
我想清空 CKEditor 中的文本区域。 我可以使用 SetData(' ') 清除 TextArea,但只能在页面加载后清除一次。 我只在 Onchange 事件中编写了 jquery 函数。
使用 iOS6 的很棒的新 UICollectionView 我如何能够删除一个大循环中的所有 UICollectionViewCell 对象? 假设我已经将所有数据加载到其中,我点击刷新,我想删除那
有没有办法在不诉诸目标的情况下删除 ItemGroup 的内容?我正在寻找相当于: 谢谢 最佳答案 不可以,正如文档所述,Remove 只能包含在 Target 内的 ItemGroup 中
我想清除数组对象中的所有元素(可以是标准的 PHP 数组、ArrayObject 或基本上实现基本数组接口(interface)的任何其他对象,如 Itertable、ArrayAccess、Coun
我有一个 9x9 的网格布局,并生成 Jtextareas 来填充它。如果用户按下按钮,我希望网格布局再次变空,以便我可以再次填充它,但与之前填充的内容无关。是否有某种命令,例如 gridlayout
使用 iOS6 的很棒的新 UICollectionView 我如何能够删除一个大循环中的所有 UICollectionViewCell 对象? 假设我已经将所有数据加载到其中,我点击刷新,我想删除那
我正在尝试在 Eclipse 中使用 Nutch 运行爬网。 我正在使用一个名为 urls 的文件,它包含 http://www.google.com/ 但是,当我运行该项目时,Generator 类
$(document).ready(function () { $('#btnSearch').bind('click', function () {
我有一个 jquery 函数,它在单击事件时清空一个 div,获取一些 json,然后附加到已清除的 div。但是,我试图附加到所述 div 的复选框没有出现。这是我的代码: $(function()
我见过类似的问题,但没有一个和我的完全一样,而且我无法理解答案,所以我希望你能帮助我。 thread我指的是以某种方式解决了异步任务或其他问题,但我不确定那是什么。我的问题是我的布局有一个 TextV
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
一些事实: - 我的应用程序是客户端。 - 我有一个Socket 池。 - 多个 Thread 使用此池。 - 每个线程都可以超时。 - 超时时,Socket 返回到池中,即使没有从服务器读取回复。
请考虑以下代码,包括两个线程 buffering_thread(用一条消息填充缓冲区指针)和 sending_thread(清空缓冲区): #include "msg.cpp" msg * buffe
我制作了这个板,以随机顺序附加了一些框。 当单击按钮时,我想以新的随机顺序附加框,但显然不起作用(.board 保持为空) http://jsbin.com/pedanobawe/2/edit?htm
我有一个脚本,它将文件列表存储在一个数组中,如下所示 set -A my_array $(ls -tr $INPUT_DIRECTORY/*) 我必须清空这个 my_array 变量才能将其用于其他目
我是一名优秀的程序员,十分优秀!