Where You Should Put Your App’s Files

To prevent the syncing and backup processes on iOS devices from taking a long time, be selective about where you place files inside your app’s home directory. Apps that store large files can slow down the process of backing up to iTunes or iCloud. These apps can also consume a large amount of a user's available storage, which may encourage the user to delete the app or disable backup of that app's data to iCloud. With this in mind, you should store app data according to the following guidelines:

  • Put user data in the <Application_Home>/Documents/. User data is any data that cannot be recreated by your app, such as user documents and other user-generated content.

  • Handle support files—files your application downloads or generates and can recreate as needed—in one of two ways:

    • In iOS 5.0 and earlier, put support files in the <Application_Home>/Library/Caches directory to prevent them from being backed up

    • In iOS 5.0.1 and later, put support files in the <Application_Home>/Library/Application Support directory and apply the com.apple.MobileBackup extended attribute to them. This attribute prevents the files from being backed up to iTunes or iCloud. If you have a large number of support files, you may store them in a custom subdirectory and apply the extended attribute to just the directory.

  • Put data cache files in the <Application_Home>/Library/Caches directory. Examples of files you should put in this directory include (but are not limited to) database cache files and downloadable content, such as that used by magazine, newspaper, and map apps. Your app should be able to gracefully handle situations where cached data is deleted by the system to free up disk space.

  • Put temporary data in the <Application_Home>/tmp directory. Temporary data comprises any data that you do not need to persist for an extended period of time. Remember to delete those files when you are done with them so that they do not continue to consume space on the user’s device.

iOS文件保存策略的更多相关文章

  1. iOS 5的文件存储策略应对

    苹果在iOS 5系统时,对app的文件存储提出了新的要求.从它的guildline来看,是推荐开发者尽量把app生成的文件放在Caches目录下的.原文如下: Only user-generated ...

  2. iOS——文件操作NSFileManager (创建、删除,复制,粘贴)

    iOS——文件操作NSFileManager (创建.删除,复制,粘贴)       iOS的沙盒机制,应用只能访问自己应用目录下的文件.iOS不像android,没有SD卡概念,不能直接访问图像.视 ...

  3. IOS文件操作的两种方式:NSFileManager操作和流操作

    1.常见的NSFileManager文件方法 -(NSData *)contentsAtPath:path //从一个文件读取数据 -(BOOL)createFileAtPath: path cont ...

  4. Android进阶:一、日志打印和保存策略

    前言: 项目开始没有做好日志统计工作,每次有问题后端都得找前端对接,严重影响工作效率.最近特地在项目中加上日志保存策略,在此分享,供需要的人学习. 一.更详细的日志信息 既然决定自定义一个log,那我 ...

  5. Android数据保存之文件保存

    前言: 上一篇文章写了在Android中利用SharedPreferences保存数据,SharedPreferences在保存数据的时候主要是保存一些应用程序的设置信息或者少量的用户信息,并且是以k ...

  6. C++ 文件保存

      文件保存: #include <sstream>#include <fstream>using namespace std; /*save to path ./record ...

  7. C++第15周(春)项目2 - 用文件保存的学生名单

    课程首页在:http://blog.csdn.net/sxhelijian/article/details/11890759.内有完整教学方案及资源链接 本程序中须要的相关文件.请到http://pa ...

  8. iOS文件处理类

    iOS文件处理类 这是一个用来简化iOS中关于文件操作的一个类,所有方法都为类方法. Source File.h // // File.h // FileManager // // http://ho ...

  9. IE浏览器下载文件保存时提示:“你没有权限在此位置中保存文件”解决办法

    E浏览器下载文件保存时提示 解决办法: 1.Win + R,打开运行命令,输入gpedit.msc,如图所示 2.打开计算机本地组策略编辑器:选择计算机配置-windows设置-安全设置-本地策略-安 ...

随机推荐

  1. Google - Pagerank

    词条权值的局限. 上一篇blog以信息和概率的角度探讨了词条对于文档的权值. 见blog:http://blog.csdn.net/ice110956/article/details/17243071 ...

  2. Oracle管道函数(Pipelined Table Function)介绍

    一 概述: 1.管道函数即是能够返回行集合(能够使嵌套表nested table 或数组 varray)的函数,我们能够像查询物理表一样查询它或者将其  赋值给集合变量. 2.管道函数为并行运行,在普 ...

  3. C#、ASP.NET、WinForm - 实现邮件发送的功能

    转载自:http://www.cnblogs.com/mingmingruyuedlut/archive/2011/10/14/2212255.html 发送邮件所用的核心知识点 微软封装好的Mail ...

  4. Windows Azure使用VS 2010的云应用开发过程

    原文 Windows Azure使用VS 2010的云应用开发过程 作为技术人员,如果在2010还不知道云计算,那么你已经“OUT”了:作为Visual Studio平台的使用者,如果你不知道VS 2 ...

  5. python获取实时股票信息

    Python3获取股票行情数据(中国个股/中国指数/全球指数) #!/usr/local/bin/python3 #coding=utf-8 #source http://www.cnblogs.co ...

  6. Android学习笔记(九)——更复杂的进度对话框

    显示操作进度的对话框 1.使用上一篇创建的同一项目.在activity_main.xml文件里加入一个Button: <Button android:id="@+id/btn_dial ...

  7. 通过cl_dd_document来实现在ALV中输出标题头

    *&---------------------------------------------------------------------* *& Report ZTEST_LIN ...

  8. TCP的三次握手和四次挥手(转)

    注:主动.被动 与 服务器.客户端没有明确的对应关系. 这个图N多人都知道,它排除和定位网络或系统故障时大有帮助,但是怎样牢牢地将这张图刻在脑中呢?那么你就一定要对这张图的每一个状态,及转换的过程有深 ...

  9. OSGi:生命周期层

    前言 生命周期层在OSGi框架中属于模块层上面的一层,它的运作是建立在模块层的功能之上的.生命周期层一个主要的功能就是让你能够从外部管理应用或者建立能够自我管理的应用(或者两者的结合),并且给了应用本 ...

  10. Linux Crontab 定时任务使用总结

    任务调度的crond常用命令 crond 是linux用来定期执行程序的命令.当安装完成操作系统之后,默认便会启动此任务调度命令.crond命令每分锺会定期检查是否有要执行的工作,如果有要执行的工作便 ...