您的位置:首页 > 移动开发

iOS获取沙盒目录+URLForDirectory:inDomain:appropriateForURL:create:error: NSFileManager

2014-01-18 22:32 1166 查看
参考:

1. http://stackoverflow.com/questions/13983091/nsfilemanager-urlsfordirectory-or-urlfordirectory
2. http://blog.csdn.net/enuola/article/details/8076221
目的:

其实参考里已经介绍了获取沙盒路径方法,但是我很想知道的是用NSUserDomainMask时,使用不同NSSearchPathDirectory 我的iOS返回是什么?

Environment: Mount Lion ,Xcode 4.5.3 , cocos2d-iphone V2.0

NSSearchPathDirectory值实际ios返回值
NSApplicationDirectory = 1file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications
NSDemoApplicationDirectoryfile://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications/Demos
NSDeveloperApplicationDirectoryfile://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Developer/Applications
NSAdminApplicationDirectoryfile://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications/Utilities
NSLibraryDirectoryfile://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/
NSDeveloperDirectoryfile://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Developer
NSUserDirectorynil
NSDocumentationDirectoryfile://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Documentation
NSDocumentDirectoryfile://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Documents/
NSCoreServiceDirectorynil
NSAutosavedInformationDirectory = 11file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Autosave%20Information
NSDesktopDirectory = 12file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Desktop
NSCachesDirectory = 13file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Caches/
NSApplicationSupportDirectory = 14file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Application%20Support
NSDownloadsDirectory = 15file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Downloads
NSInputMethodsDirectory = 16file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Input%20Methods
NSMoviesDirectory = 17file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Movies
NSMusicDirectory = 18file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Music
NSPicturesDirectory = 19file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Pictures
NSPrinterDescriptionDirectory = 20nil
NSSharedPublicDirectory = 21file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Public
NSPreferencePanesDirectory = 22file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/PreferencePanes
NSItemReplacementDirectory = 99nil
NSAllApplicationsDirectory = 100file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications
NSAllLibrariesDirectory = 101file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/
那么NSSearchPathDomainMask不是NSUserDomainMask时能使用urlForDirectoryxxx方法吗??iOS下有啥不同??

NSSearchPathDomainMaskURLForSearch=NSLibraryDirectoryURLForSearch=NSApplicationDirectoryURLForSearch=NSDemoApplicationDirectory
NSLocalDomainMask = 2file://localhost/Library/file://localhost/Applications/file://localhost/Applications/Demos
NSNetworkDomainMask = 4file://localhost/Network/Libraryfile://localhost/Network/Applicationsfile://localhost/Network/Applications/Demos
NSSystemDomainMask = 8file://localhost/System/Library/file://localhost/Applications/file://localhost/Applications/Demos
NSAllDomainsMask = 0x0ffff同NSUserDomainMake返回值同NSUserDomainMake返回值同NSUserDomainMake返回值
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐