文档1, document2,  document3

一、文件路径介绍

<Application_Home>/AppName.app :

  1) This is the bundle directory containing the app itself.

  2) Do not whrite anything to this directory.

  3) iCloud and iTunes do not back up.

<Application_Home>/Documents :

  1) Store critical data that not be recreated by your app.

  2) Will be copied to the new app directory while app update

  3) The contents of this directory are backed up by iTunes.

<Application_Home>/Decuments/Inbox :

  1) Use this directory to access files that your app was asked to open by oputside entities. Specifically, the Mail program places email attachments whit your app in this directory.

  2) Your app can read and delete files in this directory but cannot create new files or write to existng files. If the user tries to edit a file in this directory, your app must silently move it out of the directory before making any changes.

  3) The contents of this directory are backed up by iTunes.

<Application_Home>/tmp :

  1) Temporary data comprises any data that you do not need to presist for an extended period of time.

  2) Remember to delete those files when you are done with them so that do not continue to consume space on the user's device.

  3) iCloud and iTunes do not back up.

<Application_Home>/Library/ :

  1) Store not user data files. You typically put files in one of serveral standard subdirectories but you can also create custom subdirectory files you want to backed up but not exposed to the user.

  2) Will be copied to the new app directory while app update.

  3) The contents of this directories (with the exception of the caches subdirectory) are backed up by iTunes.

<Application_Home>/Library/Caches :

  1) Database cache files and downloadable content.

  2) Your app should be able to handle situations where cached data is deleted by the system to free up disk space.

  3) iCloud and iTunes do not back up.

  注意:获取文件路径最好使用 NSSearchPathForDirectoriesInDomains, 不要使用 [NSHomeDirectory() stringByAppendingString: @“xxxxx"]。(if Apple ever chooses to rename or move the Documents directory, your app will break.)

二、Prevent backup

  1) ios 5.1 and later,

    Add the NSURLIsExcludedFromBackupKey attribute to the corresponding NSURL object using the serResourceValue:forKey:error: method.

  2) ios 5.0.1 use

  3) iOS 5.0 and earlier, It is not possible to exclude data from backups on iOS 5.0. If your app must support iOS 5.0, then you will need to store your app data in Caches to avoid that data being backed up.

-(BOOL) addSkipBackupAttributeToItemAtURL: (NSURL *)URL {
assert([fileManager fileExistsAtPath: [URL path]]); if ([BROKER.context.device ifSystemMeetRequireVersion: @"5.1"]) {
NSError* error = nil;
BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
forKey:NSURLIsExcludedFromBackupKey error:&error];
return success; } else if ([BROKER.context.device ifSystemMeetRequireVersion: @"5.0.1"]) {
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = ;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), , );
return (result == );
} return YES;
}

三、统计文件夹的大小

Sandbox 文件存放规则的更多相关文章

  1. Destoon 模板存放规则 及 语法参考

    模板存放规则及语法参考 一.模板存放及调用规则 模板存放于系统 template 目录,template 目录下的一个目录例如 template/default/ 即为一套模板 模板文件以 .htm ...

  2. hadoop 集群及hbase集群的pid文件存放位置

    一.当hbase集群和hadoop集群停了做一些配置调整,结果执行stop-all.sh的时候无法停止集群, 提示no datanode,no namenode等等之类的信息, 查看stop-all. ...

  3. c++中头文件include规则浅析[译]

    英文原文地址 在开发大型的软件项目时,头文件需要得到恰当的管理,甚至在c中也会面临这种问题,当我们用c++开发时,头文件的管理会变得更复杂,更加耗费我们的时间去管理,下面我将讲一些包含规则来简化这个苦 ...

  4. SqlServer修改数据库文件及日志文件存放位置

    --查看当前的存放位置 select database_id,name,physical_name AS CurrentLocation,state_desc,size from sys.master ...

  5. I.MX6 Android USB Touch eGTouchA.ini文件存放

    /******************************************************************** * I.MX6 Android USB Touch eGTo ...

  6. Matlab 文件命名规则

    Matlab 文件命名规则 1.文件名命名要用英文字符,第一个字符不能是数字和下划线. 2.文件名不要取为matlab的一个固有函数,m文件名的命名尽量不要是简单的英文单词,最好是由大小写英文.数字. ...

  7. 怎样查看MySql数据库物理文件存放位置

    想导出mysql中的数据库文件,死活找不到,网上说在配置文件中有路径,可是我打开我的配置文件,里边的代码全都是注释掉的,没有一句有用的.后来在某一论坛上找到解决方法了,记录下来. 使用如下命令: my ...

  8. 更改Oracle数据文件名及数据文件存放路径

    更改Oracle数据文件名及数据文件存放路径 SQL> select * from v$dbfile;        FILE# NAME ---------- ---------------- ...

  9. ThinkPHP第七天(F函数使用,项目分组配置,项目分组模板文件放置规则配置)

    1.F(文件名称,写入数据,写入地址),用于将数据写入至磁盘文件中,如F('Data',$arr,'./Data/'),作用是将$arr写入至网站根目录的Data文件夹中的Data.php中. 2.读 ...

随机推荐

  1. Adapter适配器

    1.概念 *连接后端数据和前端显示的适配器接口 *数据和UI之间的重要连接   2. ArrayAdapter  ArrayAdapter构造器如下: ArrayAdapter(Context con ...

  2. 使用jQuery实现类似开关按钮的效果

    转自:http://www.cnblogs.com/linjiqin/p/3148228.html 本案例实现类似开关按钮效果. 页面有下拉列表.文本框.按钮等表单元素,大致实现如下效果:1.页面一加 ...

  3. 绑定GoDaddy域名到OpenShift应用

    一.申请GoDaddy域名 二.托管OpenShift应用 三.绑定www.mydomain.com 四.重定向mydomin.com到www.mydomain.com 五.It's go time ...

  4. TYVJ 矩阵取数 Label:高精度+dp

    题目描述 帅帅经常跟同学玩一个矩阵取数游戏:对于一个给定的n*m的矩阵,矩阵中的每个元素aij均为非负整数.游戏规则如下: 1.每次取数时须从每行各取走一个元素,共n个.m次后取完矩阵所有元素: 2. ...

  5. 解决EasyUI-Datagrid和LinqToEntity结合应用时排序问题

    我们在做WEB页面时,时常会选择JQuery框架的Datagrid,如Ext.EasyUI.Flexigrid,数据访问则采用LinqToSQL或LinqToEntity.UI用Jquery框架的目的 ...

  6. Redis中7种集合类型应用场景

    StringsStrings 数据结构是简单的key-value类型,value其实不仅是String,也可以是数字.使用Strings类型,你可以完全实现目前 Memcached 的功能,并且效率更 ...

  7. 【转】Android APK的数字签名的作用和意义

    1. 什么是数字签名? 数字签名就是为你的程序打上一种标记,来作为你自己的标识,当别人看到签名的时候会知道它是与你相关的     2. 为什么要数字签名? 最简单直接的回答: 系统要求的.  Andr ...

  8. RN组件之Switch与Picker

    一.Switch选择开关控件 1.该组件为Android/IOS通用的两种状态的开关组件 2.属性方法 (1)disabled bool:如果该值为true,用户就无法点击switch开关,默认为fa ...

  9. jstl fn标签

    JSTL使用表达式来简化页面的代码,这对一些标准的方法,例如bean的getter/setter方法,请 求参数或者context以及session中的数据的访问非常方便,但是我们在实际应用中经常需要 ...

  10. java向图片上写字,两个图片合并的方法

    package writeimg; import javax.imageio.ImageIO; import java.awt.Color; import java.awt.Font; import ...