Adding images to iPhone Simulator

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?


Note - while this is valid, and works, I think Koen's solution below is now a better one, since it does not require rebooting the simulator.

Identify your simulator by going to xCode->Devices, selecting your simulator, and checking the Identifier value.

Go to

~/Library/Developer/CoreSimulator/Devices/[Simulator Identifier]/data/Media/DCIM/100APPLE

and add IMG_nnnn.THM and IMG_nnnn.JPG. You will then need to reset your simulator (Hardware->Reboot) to allow it to notice the new changes. 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.


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 ;)
  • Update: for iOS Simulator 4.2, do these steps twice to get it work. Thanks kevboh !

    Update: This also works for iOS Simulator 6.1


    3 Simple Steps

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

    链接地址: http://www.djcxy.com/p/63248.html

    上一篇: iPhone Simulator在哪里存储数据?

    下一篇: 将图像添加到iPhone Simulator