标签:
iOS沙盒
每个ios应用都有自己的应用沙盒,应用沙盒就是文件系统目录,默认下iOS应用只能访问自己的沙盒
extenaion是iOS8新开放的一种对几个固定系统区域的扩展机制,它可以在一定程度上弥补iOS的沙盒机制对应用间通信的限制
应用程序包:
Documents 持久化数据
tmp 临时目录
Library
cache 缓存
Preferences 配置信息\SQLite
沙盒路径获取的方法
1、沙盒的路径
2、Documents 路径
3、tmp 路径
4、Library 路
// 获取目录 // Mac 用户根目录 /Users/cloudwalk // iOS /Users/cloudwalk/Library/Developer/CoreSimulator/Devices/6B973E5D-1F17-488E-BCF5-BC6C3456B220/data/Containers/Data/Application/E1E7C33A-B603-46CE-B2DC-C8F578A698F0 // 沙盒根目录 NSString *sandboxPath = NSHomeDirectory(); NSLog(@"sandboxPath = %@",sandboxPath); // Documents 路径 // // NSSearchPathForDirectoriesInDomains 返回绝对路径 // NSDocumentationDirectory 表示获取沙盒的Document目录 /* Mac 获取的"/Users/cloudwalk/Library/Documentation" iOS 获取的"/Users/cloudwalk/Library/Developer/CoreSimulator/Devices/6B973E5D-1F17-488E-BCF5-BC6C3456B220/data/Containers/Data/Application/E8511606-E87E-4A69-9924-EC0C0549DC09/Library/Documentation" */ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSLog(@"%@",paths); NSString *documentPath = [paths lastObject]; NSLog(@"paths = %@",documentPath )
标签:
原文地址:http://www.cnblogs.com/1023843587qq/p/4801634.html