One can view files in an iOS device but only in that your App's sandbox. Every App has got a Documents
, Cache
and temp
folders. I think the first two are automatically backed up by iTunes when you connect your device, the latter is not backed up.
Example, to get Cache directory path -
- (NSString *)getCacheDirPath
{
NSString *path = nil;
NSArray *myPathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
if([myPathList count])
{
NSString *bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
path = [[myPathList objectAtIndex:0] stringByAppendingPathComponent:bundleName];
}
return path;
}
To see all files in caches
directory -
- (NSMutableArray *)showFiles
{
NSError *err = nil;
NSArray *myPathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *myPath = [myPathList objectAtIndex:0];
NSArray *dirContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:myPath error:&err];
if(err) NSLog(@"showFiles() - ERROR: %@",[err localizedDescription]);
NSMutableArray *filePaths = nil;
int count = (int)[dirContent count];
for(int i=0; i<count; i++)
{
[filePaths addObject:[dirContent objectAtIndex:i]];
}
return filePaths;
}