UIKit
Path
默认包含 3 个文件夹:
- Documents:会备份该目录;
- Library:会备份该目录(除了 Library/Cahces)
- Caches:缓存文件,不备份,应用推出时不删除文件;
- tmp:不会备份该目录,且重启后丢失;
// Home 目录,App 的沙盒目录
var path = NSHomeDirectory()
// 获取 Documents 目录
path = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first!
// 获取 Library 目录
path = NSSearchPathForDirectoriesInDomains(.LibraryDirectory, .UserDomainMask, true).first!
// 获取 Caches 目录
path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true).first!
// 获取 tmp 目录
path = NSTemporaryDirectory()