1

I have found half a dozen answers about where the iPhone Simulator folder is. This does not display my iPad Applications though.

Does anyone know where the iPad Simulator folder location is or a way to get the location?

App Dev Guy
  • 5,396
  • 4
  • 31
  • 54
  • 2
    print this [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] and u would get the location. – Dheeraj Singh Feb 19 '15 at 06:15
  • possible duplicate of [Where Does Simulator 8.0 Store Files](http://stackoverflow.com/questions/24022570/where-does-simulator-8-0-store-files) – Jeremy Huddleston Sequoia Feb 19 '15 at 09:17
  • @JeremyHuddlestonSequoia It's a solid answer about iOS8. Fortunately I asked about iPads specifically because I can find the store for my iPhone the old way but not an iPad. So not a duplicate in my opinion because it is **not** the question I asked and the answer is specific to iOS 8 and not iPads. – App Dev Guy Feb 19 '15 at 09:42
  • @SASmith It is a duplicate. All of your simulated devices (your simulated iPads included) are in ~/Library/Developer/CoreSimulator/Devices. – Jeremy Huddleston Sequoia Feb 19 '15 at 16:01
  • It not for the duplicate question. Pre iOS 7 contains a different path. I didn't search based on iOS versions, as you should be able to read, that isn't the question I was asking, nor did it seem relevant because I didn't know about any changes in pathways in the first place. I asked about iPads based on the fact that I could only find iPhones as the **only** present option in stack questions regarding simulator file locations. This is highlighted in my question. Read the question instead of jumping to conclusions. – App Dev Guy Feb 19 '15 at 16:08

3 Answers3

5

Direct to the directory containing all simulators:

  1. Right Click on the "Finder" icon in your dock

  2. Click on Go to Folder

    ~/Library/Developer/CoreSimulator/Devices/

Swift

Use this print statement:

print(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last)

Objective-C

You can find the exact location by using NSLog Print statement

NSLog(@"%@",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);

Then follow the first set of instructions with your location.

Tung Fam
  • 7,899
  • 4
  • 56
  • 63
App Dev Guy
  • 5,396
  • 4
  • 31
  • 54
  • 1
    Minor correction: I believe you meant **User Name** instead of **Your Mac Name**. – Nicolas Miari Feb 19 '15 at 07:18
  • User Name should work but doesn't seem to according to some of the iPhone Simulator folder answers on other questions and did not work for me. But if it works for others, great. Your comment is helpful to those who can use it :-) Thanks for that. – App Dev Guy Feb 19 '15 at 07:21
  • 2
    Computer name and user name are two different concepts in OSX. The file path you posted should contain your **user name** (e.g., `johnsmith`) between `/Users/` and `/Library/`. A common unix shortcut for the current user's home directory is "~", which in this case would give `~/Library/Developer/CoreSimulator/Devices/` (no need to type the actual user name). – Nicolas Miari Feb 19 '15 at 07:25
  • Ah I see what you mean. I mean the same thing. Thanks for that. I will update the answer. Also thanks for the " ~ " suggestion. – App Dev Guy Feb 19 '15 at 07:27
0

Put this code in your viewDidLoad

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(@"path-%@",documentsDirectory);

Then open finder in your mac. Press Command+Shift+G and input the "documentsDirectory" that was printed in console using NSLog. That will show your path for the app document directory.

App Dev Guy
  • 5,396
  • 4
  • 31
  • 54
ashForIos
  • 399
  • 1
  • 5
  • 18
0

The folder location has been changed, instead of going to iPhone Simulator you have to go to Core Simulator.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", cachesDirectory, fileName];
if ([[NSFileManager defaultManager]fileExistsAtPath:filePath]) {
    return filePath;
}
else {
    return filePath;
}

This code will show how you can check the files stored in the cache and how you can find the folder location.

Print description for the cache directory to get the path.

App Dev Guy
  • 5,396
  • 4
  • 31
  • 54
Chirag
  • 259
  • 1
  • 8