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?
views:
7192answers:
6Go 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.
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 ?
Explain step by step of Airsource Ltd's answer for adding image to simulator:
- Drag it to simulator, then Safari opens (or browse to the Image in the internet using Safari)
- Hold your click on the image
- When the pop-up appears, choose Save Image and enjoy ;)
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)
ALl of these answers are ok in previous SDK but not with iPhone Simulator 4.0, i've tried all! Any clue?
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.