The directory of paths that can be used in iOS

NSSearchPathDirectory

These constants determine the location of various 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; 

In this path directory, I know that NSCachesDirectory and NSDocumentDirectory can be used on iOS. Do you know some others too?

At the moment I am uploading images to NSCachesDirectory, and I am using [UIImage imageNamed:] to print images on the screen. But I'm looking for a clearer folder for storing my images.

Thanks,

+8
directory ios iphone path
source share
1 answer

As far as I know, only they can be used in 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 are:

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

All paths belong to the application sandbox directory, and you should be able to write for all of them. All of these directories have different behavior and are designed for different types of files.


To store the images, I will create a directory in the Library, say Library/Thumbnails/ . If the images can be easily restored or downloaded, then you should create and use Library/Caches/Thumbnails/ .

+11
source share

All Articles