参考:
1. http://stackoverflow.com/questions/13983091/nsfilemanager-urlsfordirectory-or-urlfordirectory
2. http://blog.youkuaiyun.com/enuola/article/details/8076221
目的:
其实参考里已经介绍了获取沙盒路径方法,但是我很想知道的是用NSUserDomainMask时,使用不同NSSearchPathDirectory 我的iOS返回是什么?
Environment: Mount Lion ,Xcode 4.5.3 , cocos2d-iphone V2.0
| NSSearchPathDirectory值 | 实际ios返回值 |
|---|---|
| NSApplicationDirectory = 1 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications |
| NSDemoApplicationDirectory | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications/Demos |
| NSDeveloperApplicationDirectory | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Developer/Applications |
| NSAdminApplicationDirectory | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications/Utilities |
| NSLibraryDirectory | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/ |
| NSDeveloperDirectory | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Developer |
| NSUserDirectory | nil |
| NSDocumentationDirectory | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Documentation |
| NSDocumentDirectory | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Documents/ |
| NSCoreServiceDirectory | nil |
| NSAutosavedInformationDirectory = 11 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Autosave%20Information |
| NSDesktopDirectory = 12 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Desktop |
| NSCachesDirectory = 13 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Caches/ |
| NSApplicationSupportDirectory = 14 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Application%20Support |
| NSDownloadsDirectory = 15 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Downloads |
| NSInputMethodsDirectory = 16 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/Input%20Methods |
| NSMoviesDirectory = 17 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Movies |
| NSMusicDirectory = 18 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Music |
| NSPicturesDirectory = 19 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Pictures |
| NSPrinterDescriptionDirectory = 20 | nil |
| NSSharedPublicDirectory = 21 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Public |
| NSPreferencePanesDirectory = 22 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/PreferencePanes |
| NSItemReplacementDirectory = 99 | nil |
| NSAllApplicationsDirectory = 100 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Applications |
| NSAllLibrariesDirectory = 101 | file://localhost/Users/hemarcus/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/00F96338-26D1-491D-8BA7-E97663752A1F/Library/ |
| NSSearchPathDomainMask | URLForSearch=NSLibraryDirectory | URLForSearch=NSApplicationDirectory | URLForSearch=NSDemoApplicationDirectory |
|---|---|---|---|
| NSLocalDomainMask = 2 | file://localhost/Library/ | file://localhost/Applications/ | file://localhost/Applications/Demos |
| NSNetworkDomainMask = 4 | file://localhost/Network/Library | file://localhost/Network/Applications | file://localhost/Network/Applications/Demos |
| NSSystemDomainMask = 8 | file://localhost/System/Library/ | file://localhost/Applications/ | file://localhost/Applications/Demos |
| NSAllDomainsMask = 0x0ffff | 同NSUserDomainMake返回值 | 同NSUserDomainMake返回值 | 同NSUserDomainMake返回值 |
本文详细介绍了在iOS环境中使用NSFileManager获取不同NSSearchPathDirectory时返回的具体路径,并对比了使用不同NSSearchPathDomainMask的区别。
1922

被折叠的 条评论
为什么被折叠?



