Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Document directory path of Xcode Device Simulator

In iOS 7, the document directory of the iOS simulators can be found in:

/Users/Sabo/Library/Application Support/iPhone Simulator/ 

However, in iOS 8 Beta Simulator, I can't find the corresponding directory for iOS 8 in the directory above.

Where's the document directory path for the iOS 8 Simulator?

enter image description here

like image 692
Fire Fist Avatar asked Aug 08 '14 08:08

Fire Fist


People also ask

Where is device and simulator in Xcode?

The basic way to open a list of simulators is to use Xcode -> Window -> Devices and Simulators.


2 Answers

on my computer, the path is:

~/Library/Developer/CoreSimulator/Devices/1A8DF360-B0A6-4815-95F3-68A6AB0BCC78/data/Container/Data/Application/ 

NOTE: probably those long IDs (i.e UDIDs) are different on your computer.

like image 136
holex Avatar answered Oct 01 '22 03:10

holex


NSLog below code somewhere in "AppDelegate", run your project and follow the path. This will be easy for you to get to the documents rather than searching randomly inside "~/Library/Developer/CoreSimulator/Devices/"

Objective-C

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

Swift
If you are using Swift 1.2, use the code below which will only output in development when using the Simulator because of the #if #endif block:

#if arch(i386) || arch(x86_64)   let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! NSString   NSLog("Document Path: %@", documentsPath) #endif 

Copy your path from "/Users/ankur/Library/Developer/CoreSimulator/Devices/7BA821..." go to "Finder" and then "Go to Folder" or command + shift + g and paste your path, let the mac take you to your documents directory :)

like image 24
Ankur Avatar answered Oct 01 '22 02:10

Ankur