I am developing application for ipad3 with file sharing through iTunes.Problem is that i can share only single file with my application.I want to add folders and sub folders to document folders. How can i add folders to document folder through iTunes file sharing?
Asked
Active
Viewed 317 times
1 Answers
0
You can create directories
using NSFileManager
The method below will return the path to directory userName if it exists and create it if it doesn't.
+ (NSString *)getDocsDirectoryByUserName:(NSString *)userName
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentDir = [paths objectAtIndex:0];
NSString * userDir = [documentDir stringByAppendingPathComponent:userName];
NSError *error;
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:userDir
withIntermediateDirectories:YES
attributes:nil error:&error];
if (!success) {
NSLog(@"Error creating data path: %@", [error localizedDescription]);
}
return userDir;
}

spring
- 18,009
- 15
- 80
- 160