Search code examples
iosios-simulator

Adding image to iPhone simulator cause error (PHPhotosErrorDomain error -1.)


I'm trying to drag and drop image to my iPhone simulator. I found to do it this way here on SO Adding images or videos to iPhone Simulator . However when I tried to drag and drop simple png or jpeg image I get an error

operation couldn’t be completed. (PHPhotosErrorDomain error -1.)

I know that the solution in the answer is like 9 years old and I haven't found any latest solution so does something changed?

My iOS simulator version is

Version 11.5 (921.9.1) SimulatorKit 581.9.1 CoreSimulator 704.12.2


Solution

  • Move your files into the Documents folder and then drag them into the simulator.

    This will trigger the simulator to ask for permissions to access your files. Having them inside the Downloads folder, will not.