Search code examples
iosxcodeios-simulatordirectory-structureabsolute-path

access iPhone simulator root and home directories


I need to find a path where iPhone simulator root / and home ~ directories lies. With NSFileManager I can print their contents, however I need to place some files there so that I could open them with my application in simulator.

My operating system is OS X 10.9.4 on mac-mini.

Update:

Basically what I need to access simulators file system and not the sand-boxed location that is relative to an app, and this is because I need to test my app with absolute paths. For example if that would be an sd card or just some other known location.

To emphasize what I am asking for. With this code:

    NSFileManager* fileManager = [NSFileManager defaultManager];
    NSArray* rootContent = [fileManager contentsOfDirectoryAtPath:@"/" error:nil];
    NSLog (@"ROOT dir contains:");
    for (NSString* fileName in rootContent)
        NSLog (@"%@", fileName);

I get this output:

2014-07-18 11:08:02.893 appName[34509:60b] ROOT dir contains:
2014-07-18 11:08:02.893 appName[34509:60b] .DocumentRevisions-V100
2014-07-18 11:08:02.894 appName[34509:60b] .file
2014-07-18 11:08:02.894 appName[34509:60b] .fseventsd
2014-07-18 11:08:02.894 appName[34509:60b] .hotfiles.btree
2014-07-18 11:08:02.894 appName[34509:60b] .PKInstallSandboxManager
2014-07-18 11:08:02.894 appName[34509:60b] .Spotlight-V100
2014-07-18 11:08:02.894 appName[34509:60b] .Trashes
2014-07-18 11:08:02.895 appName[34509:60b] .vol
2014-07-18 11:08:02.895 appName[34509:60b] Applications
2014-07-18 11:08:02.895 appName[34509:60b] bin
2014-07-18 11:08:02.895 appName[34509:60b] cores
2014-07-18 11:08:02.895 appName[34509:60b] dev
2014-07-18 11:08:02.895 appName[34509:60b] etc
2014-07-18 11:08:02.895 appName[34509:60b] home
2014-07-18 11:08:02.895 appName[34509:60b] Library
2014-07-18 11:08:02.896 appName[34509:60b] mach_kernel
2014-07-18 11:08:02.896 appName[34509:60b] net
2014-07-18 11:08:02.896 appName[34509:60b] Network
2014-07-18 11:08:02.896 appName[34509:60b] private
2014-07-18 11:08:02.896 appName[34509:60b] sbin
2014-07-18 11:08:02.896 appName[34509:60b] System
2014-07-18 11:08:02.896 appName[34509:60b] tmp
2014-07-18 11:08:02.897 appName[34509:60b] User Information
2014-07-18 11:08:02.897 appName[34509:60b] Users
2014-07-18 11:08:02.897 appName[34509:60b] usr
2014-07-18 11:08:02.897 appName[34509:60b] var
2014-07-18 11:08:02.897 appName[34509:60b] Volumes

So this is a root / directory content and I want to access it in my OS-X file system, if that is possible, well and if it is not possible it would be great to know if there is any other location which I could access with my application and file system with a known absolute path.


Solution

  • If you are trying to open the folder on your Mac, you can use a software named SimHolder. If you want to access these folders in your iPhone Application on iOS simulator, you can't open any folder outside your iOS app's sandbox.