Adding images to the iPhone Simulator

Occasionally I need to create an iPhone app which can either take a picture or select one from the user's library. Testing such an app on the iPhone simulator is a pain; the simulator doesn't include a simulated camera, and it doesn't provide a way to sync photos from iTunes.

I keep forgetting how to load images into the simulator's photo library. Here's a method that works well, courtesy of Stack Overflow:

  • Launch the iPhone Simulator.
  • In the simulator, launch Safari.
  • Drag an image from the Finder into the simulator. It should appear in Safari.
  • Click and hold the mouse on the image.
  • An action sheet should appear. Choose 'Save Image'.

To confirm that the image got added you can launch Photos in the simulator. The image should appear in your Saved Photos album.