开发者

Path directory usable in iOS

NSSearchPathDirectory

These constants specify the location of a variety of directories.

enum {
   NSApplicationDirectory = 1,
   NSDemoApplicationDirectory,
   NSDeveloperApplicationDirectory,
   NSAdminApplicationDirectory,
   NSLibraryDirectory,
   NSDeveloperDirectory,
   NSUserDirectory,
   NSDocumentationDirectory,
   NSDocumentDirectory,
   NSCoreServiceDirectory,
   NSAutosavedInformationDirectory = 11,
   NSDesktopDirectory = 12,
   NSCachesDirectory = 13,
   NSApplicationSupportDirectory = 14,
 开发者_JAVA技巧  NSDownloadsDirectory = 15,
   NSInputMethodsDirectory = 16,
   NSMoviesDirectory = 17,
   NSMusicDirectory = 18,
   NSPicturesDirectory = 19,
   NSPrinterDescriptionDirectory = 20,
   NSSharedPublicDirectory = 21,
   NSPreferencePanesDirectory = 22,
   NSItemReplacementDirectory = 99,
   NSAllApplicationsDirectory = 100,
   NSAllLibrariesDirectory = 101
};
typedef NSUInteger NSSearchPathDirectory;

Among those path directory, I know that NSCachesDirectory and NSDocumentDirectory are usable in iOS. Do you know if some others are too ?

For the moment I'm downloading images in NSCachesDirectory and I use [UIImage imageNamed:] to print pictures at the screen. But I'm looking for a more explicit folder to store my images.

Thanks,


As far as I know only these are usable on iOS:

NSDocumentDirectory is Documents/     (persistent, backed up, may be visible in iTunes)
NSLibraryDirectory is Library/     (persistent, backed up, not visibe to the user)
NSCachesDirectory is Library/Caches/     (not backed up, may be cleared by system)

In addition, there is:

NSTemporaryDirectory() is tmp/     (not backed up, *will* be cleared by system)

All paths are relative to application sandbox directory and you should be able to write to all of them. All those directories have different behavior and are for different types of files.


For storing the images, I would create directory in Library, let's say Library/Thumbnails/. If the images are easily recreatable or downloadable, then you should create and use Library/Caches/Thumbnails/.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜