views:

7192

answers:

6

I am trying to use UIImagePickerController with UIImagePickerControllerSourceTypePhotoLibrary, but it says, "No photos". Where does the simulator get the images from? Where should I copy the images so that they are displayed in the simulator?

+12  A: 

Go to ~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/ and add IMG_nnnn.THM and IMG_nnnn.JPG. It doesn't matter if they are not JPEGs - they can both be PNGs, but it appears that both of them must be present for it to work. You may need to create DCIM if it doesn't already exist, and in that case you should start nnnn from 0001. The JPG files are the fullsize version, while the THM files are the thumbnail, and are 75x75 pixels in size. I wrote a script to do this, but there's a better documented one over here.

You can also add photos from safari in the simulator, by Tapping and Holding on the image. If you drag an image (or any other file, like a PDF) to the simulator, it will immediately open Safari and display the image, so this is quite an easy way of getting images to it.

Airsource Ltd
Under iPhone SDK 3.0, this has changed just a bit. Now, the thumbnail files (".THM") need to go under 100APPLE/.MISC. Otherwise, all the photos will appear as black boxes.
mtnygard
How do I update the icon on the Saved Photos cell in the main Photo Album table view?
sbwoodside
My location is at `~/Library/Application Support/iPhone Simulator/3.1.3/Media/DCIM/100APPLE`
Gerald Kaszuba
how do you get the .thm files from images coming from an iPhone?
Kamchatka
A: 

and the IMG_nnnn.THM abd IMG_nnnn.JPG , wht are these supposed to be ? i cant just remane any img to it and place it in the folder ?

Vijayeta
a) Changed my answer to indicate what nnnn is. b) Probably better to comment my answer, rather than post a new one. Your answer won't always appear directly below my mine.
Airsource Ltd
+6  A: 

Explain step by step of Airsource Ltd's answer for adding image to simulator:

  1. Drag it to simulator, then Safari opens (or browse to the Image in the internet using Safari)
  2. Hold your click on the image
  3. When the pop-up appears, choose Save Image and enjoy ;)
Thanh-Cong Vo
+3  A: 

3 Simple Steps

1) Drag & Drop image onto simulator
- this will open a browser with your image
2) Click & hold image
- this will open options
3) save image
- this will copy image onto simulator
Watch YouTube Video ( add images to iphone simulator)

A: 

ALl of these answers are ok in previous SDK but not with iPhone Simulator 4.0, i've tried all! Any clue?

sicario
A: 

If you need to import more than just one or two photos then take a look at this article that I wrote. It describes an easy way to perform a bulk import of photos and works for iOS 4.x.

Robin Summerhill