tags:

views:

19

answers:

1

i want to see the content of Documents folder from console , i can see for simulator but its not working for device

my path is /var/mobile/Applications/3E79C7B3-2639-477F-B355-1A3C70D4ECBE/Documents but how to check this ???

+1  A: 

You can get the location of the Documents directory like so:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
path = [paths objectAtIndex:0];

And then simply print the contents of the directory to the console:

NSLog(@"%@", [[NSFileManager defaultManager] contentsOfDirectoryAtPath:paths error:nil]);

Here's the relevant documentation: http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Articles/StandardDirectories.html

anshuchimala
i mean so we cant see the hard copy of file as we can see for simulator??
ram
hey in simulator i can see icell, list, "sample1.cfg" but on iphone i can see only icell .. so is something wrong???
ram
I'm not sure what you mean. You mean there are files missing from the Documents folder on your device? And what do you mean by "see the hard copy of the file"? You can't actually get to the file in the Finder as you can with the simulator, if that's what you mean.
anshuchimala
yes i was thinking of that only point is i want to trace the path and pull data from path but simulator and iphone they hav different path so which path i choose to open file from document folder??
ram
Are you trying to access files inside your Documents folder? It sounds like you're trying to hard code the path to the Documents folder. Don't do that, use NSSearchPathForDirectoriesInDomains as shown above.
anshuchimala