Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add images to iPhone Simulator?

I have used 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?

like image 925
Want Query Avatar asked Mar 24 '15 12:03

Want Query


3 Answers

If someone gets an error similar to

One or more media items failed to import:

/Users/Username/Desktop/Screenshots/Screen Shot 2021-07-09 at 12.05.29.png: The operation couldn’t be completed. (Cocoa error -1.)

You can try to move the picture to the user's root folder. In my case /Users/Username/Screen Shot 2021-07-09 at 12.05.29.png, and I was able to drag and drop my image from Finder to the simulator.

like image 196
John Avatar answered Oct 11 '22 12:10

John


Now you can do this easily just by dragging and dropping the images in to Photos app in iPhone Simulator.

like image 23
Vinoth Vino Avatar answered Oct 11 '22 12:10

Vinoth Vino


  1. Run the simulator
  2. Run Safari on the Simulator
  3. Drag a picture onto Safari running on the Simulator, this opens the image.
  4. Click and hold on the image, or tap on the share icon in the bottom tool bar.
  5. You will get an alert asking if you want to store the image to your phone
like image 36
Dirder Avatar answered Oct 11 '22 11:10

Dirder