Pages

July 21, 2013

Get the Documents directory of your App

Get the "Documents" folder of your iPhone, iPad or iPod app.


/** Returns the full path of /Documents directory.

 It actually expands tilde (~) and returns the entire long path.

 @return Returns the path of /Documents directory, or nil in case of error.
 @see createFolderInDocumentDirectoryWithName:
 @see createFolderInTempDirectoryWithName:
 @see createFolderWithName:

 */
+ (NSString *)documentsDirectory {
    NSArray *paths    = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *docDir= ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
    return docDir;
}



Download the ready-for-use source file (.m) of Get the Documents directory of your App

No comments:

Post a Comment