iOS Simulator
iOS Development
File Management
App Testing
Xcode

How to add files to the iOS Simulator

Codemia Knowledge Hub ·

The simplest way to add files to the iOS Simulator is to open the simulator's data folder in Finder from Xcode, find your app's container, and drag the files into its Documents folder (or another relevant directory). This is useful for testing file handling, giving your app static files, or reproducing a specific environment.

Adding files through Xcode and Finder

  1. Launch Xcode and Simulator
    • Open Xcode and run your application, which launches the iOS Simulator. Make sure your app is active on the simulator.
  2. Open the simulator's files in Finder
    • Go to Window > Devices and Simulators in Xcode.
    • Select your running simulator instance.
    • Click the gear or cog icon at the bottom and select Show Device. A Finder window opens with your simulator's data.
  3. Find your app's container
    • In that Finder directory, navigate to Containers > Data > Application.
    • Identify your app by its bundle identifier, or sort the directories by modification date.
  4. Add files
    • Drag and drop files directly into the Documents folder or another relevant directory in your app's container.

The simulator's directories closely mirror the structure on a real iOS device, so you can manipulate them the same way.

Command line access with xcrun

xcrun is a CLI tool bundled with Xcode that can interact with the simulator. The first step is identifying the simulator and app identifiers. simctl get_app_container then prints the path of your app's data container, and you can copy files into it:

bash
1# List booted simulators and their UDIDs
2xcrun simctl list devices booted
3
4# Copy a file into the app's Documents folder (use a UDID instead of "booted" if several are running)
5DATA=$(xcrun simctl get_app_container booted com.example.MyApp data)
6cp ~/Desktop/sample.pdf "$DATA/Documents/"
7
8# Photos and videos go into the Photos library instead
9xcrun simctl addmedia booted ~/Desktop/photo.jpg

Third-party file browsers

  • iExplorer: Provides a GUI to navigate the iOS Simulator, letting you drag and drop files.
  • iMazing: Offers a set of file management features for accessing simulator data.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms