Document directory path of Xcode Device Simulator

前端 未结 21 1427
旧巷少年郎
旧巷少年郎 2020-11-28 02:28

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

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

However,

相关标签:
21条回答
  • 2020-11-28 02:39

    I recommend a nice utility app called SimPholders that makes it easy to find the files and folders while developing your iOS app. It has a new version to work with the new simulators called SimPholders2. It can be found at simpholders.com

    0 讨论(0)
  • 2020-11-28 02:42

    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.

    0 讨论(0)
  • 2020-11-28 02:43

    Despite the fact that here are many answers, none of them provides an understanding of how the folder structure of the iOS 8.3 simulators have changed and are not providing a quick way to find the App's Data (Documents folder).

    Since iOS 8 the Data storage folder(s) of an App are separate from the App's executable files while the iOS 7 and below are having the same folder structure, the only difference being the fact that all the simulators (different types and versions) are now in one, big folder.

    So, the path to an iOS 8,7,6 simulator is the following:

    ~/Library/Developer/CoreSimulator/Devices
    

    Every simulator is now contained in a folder named with an unique identifier which changes at every reset of a simulator.

    You can find the Identifier for each of your devices & simulators by going to Xcode > Window > Devices (the first 3 or 4 characters of the identifier are more than enough to remember).

    To find the one on which you have installed your app(s) on, take a look at your Run scheme > devices (screen 2).

    screen 1

    screen 2

    Now, after you identify your simulator, depending on its version the folder structure is very different:

    On iOS 8 the executable and the data folder of an app are in different folders:

    Executable: ~/Library/Developer/CoreSimulator/Devices/[simID]/data/Containers/Bundle/Application/[appID]

    Data Folder: ~/Library/Developer/CoreSimulator/Devices/[simID]/data/Containers/Data/Application/[appID]/

    Documents Folder: ~/Library/Developer/CoreSimulator/Devices/[simID]/data/Containers/Data/Application/[appID]/Documents

    On iOS 7 and below the folder structure is the same as before only remember that now every simulator is in the same folder (see above).

    0 讨论(0)
  • 2020-11-28 02:45

    With iOS 9.2 and Xcode 7.2, the following script will open the Documents folder of the last installed application on the last used simulator;

    cd ~/Library/Developer/CoreSimulator/Devices/
    cd `ls -t | head -n 1`/data/Containers/Data/Application 
    cd `ls -t | head -n 1`/Documents
    open .
    

    To create an easy runnable script, put it in an Automator Application with "Run Shell Script":

    0 讨论(0)
  • 2020-11-28 02:45

    Where is the Documents Directory for the iOS 8 Simulator

    You may have noticed that the iPhone Simulator has changed with Xcode 6, and with it – of course – the path to your simulated apps’ Documents Directory. At times we may need to take a look at it.

    Finding that path is not as easy as it was once, namely Library/Application Support/iPhone Simulator/7.1/Applications/ followed by a cryptic number representing your app.

    As of Xcode 6 and iOS 8 you’ll find it here: Library/Developer/CoreSimulator/Devices/cryptic number/data/Containers/Data/Application/cryptic number

    http://pinkstone.co.uk/where-is-the-documents-directory-for-the-ios-8-simulator/

    0 讨论(0)
  • 2020-11-28 02:47

    update: Xcode 11.5 • Swift 5.2

    if let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path {
        print(documentsPath)   // "var/folder/.../documents\n" copy the full path
    }
    

    Go to your Finder press command-shift-g (or Go > Go to Folder... under the menu bar) and paste that full path "var/folder/.../documents" there and press go.

    0 讨论(0)
提交回复
热议问题