Adding photos to the iPhone simulator

I am currently developing an iPhone app that will make use of the camera. Since I am also testing it in the simulator, I want to be able to select pictures from the photo library as well, if the camera is missing.

However, once I open up the UIImagePickerControllerSourceTypePhotoLibrary in the iPhone simulator, I am presented with the following screen:

 

No Photos iPhone screen

No Photos – You can sync photos and videos onto your iPhone using iTunes.

 

Uhm, can I (sync photos and videos to the simulator using iTunes)? I have not found a way, but there is an easy way to work around this and fill your iPhone with photos.

Just open up Finder and drag any image you want to add to your simulator. When you see the green plus icon, just release the image and it will open up in Safari, like this:

 

Safari browser screenshot

The Safari browser shows the image that was dragged to the simulator.

 

Now, click the image and keep the mouse button pressed, and you will get the option to save it to the simulator:

 

Save option

Press and hold the left mouse button to open the save and copy action sheet

 

That’s it! If you open up the photo library, you will see the image in your list of saved images:

 

Photo library

The photo is added to the photo library

 

Hope it helps!

Advertisements