iOS中沙盒模型

2018-03-21  本文已影响38人  Gintok

应用程序沙盒目录

通俗理解

获取app文件目录的方法

//Home目录
NSString *homeDirectory = NSHomeDirectory();

//Document目录   documents (Documents)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path = [paths objectAtIndex:0];

//Libaray目录  various documentation, support, and configuration files, resources (Library)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES);
NSString *path = [paths objectAtIndex:0];

//Cache目录  location of discardable cache files (Library/Caches)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES);
NSString *path = [paths objectAtIndex:0];
上一篇 下一篇

猜你喜欢

热点阅读