Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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,
   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,

like image 789
Nielsou Hacken-Bergen Avatar asked Sep 01 '11 09:09

Nielsou Hacken-Bergen


1 Answers

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/.

like image 111
Tricertops Avatar answered Oct 01 '22 23:10

Tricertops