Maduranga E
Maduranga E

Reputation: 1689

How to browse the iPhone simulator

my app is creating a CSV file out of a db. I want to browse and open the file to test. How do I access the iphone simulator's storage ?

Upvotes: 1

Views: 459

Answers (4)

Jack Farnandish
Jack Farnandish

Reputation: 161

pritn this path

NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);

Upvotes: 0

miho
miho

Reputation: 12085

All data of the Simulator is stored as local files on your Mac.

The path for the user data of iOS apps in the Simulator is:

~/Library/Application Support/iPhone Simulator/[OS version]/Applications/[appGUID]/

Upvotes: 5

Zhang
Zhang

Reputation: 11607

You'll want to print out the location of where you store your file when you run the app in the simulator.

You can use this code to get the location of the Library/Cache folder here:

-(NSString *) mediaPathForFileName:(NSString *) fileName
{   
    NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *cachesDirectory = [directoryPaths objectAtIndex:0];
    NSString *filePath = [NSString stringWithFormat:@"%@/%@", cachesDirectory, fileName];

    return filePath;
}

Pass in a random file name like "test.txt":

// somewhere in your viewDidLoad method
[self mediaPathForFileName:@"test.txt"];

This will print out the path to your app Library/Cache folder.

Upvotes: 1

saadnib
saadnib

Reputation: 11145

you need get the path of that file by using NSLog and then user Shift+Cmd+G to go to that path.

Upvotes: 0

Related Questions