Blog Archives

Adding an image(s) to the iPhone Simulator

I managed to finally get an image to into my iPhone Simulator, running into a problem now, I can’t find the image to delete it or change.

Anyway once you if you know the device that is running (if not you can find out the GUID here:  https://qatesttech.wordpress.com/2015/04/22/determining-which-device-is-running-in-the-iphone-simulator/)

These steps then worked for adding images:

How to bulk upload images on the iOS Simulator. (I’ve only confirmed it on 6.1.)

  1. Backup the device folder:
    1. ~/Library/Application Support/iPhone Simulator/6.1/Media
  2. Copy all your images into the folder:
    1. ~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE
  3. Move or delete the folder:
    1. ~/Library/Application Support/iPhone Simulator/6.1/Media/PhotoData
  4. Restart iOS Simulator
  5. Open the Photos app

The simulator will restore all the images from the 100APPLE folder! – yours will be there too 

Notes:
  1. My Devices aren’t in this location, they are under ~/Library/Developer….
  2. I didn’t do step 1, since launching the Simulator copies missing stuff back
Now I have the problem that even though my image doesn’t appear in the 100APPLE directory, it still shows up when the simulator runs, though if I run the simulator manually, that image isn’t there.
Update 1:
  • This isn’t a solution for me (but might be for some folks:
    • As of iOS 8, you can just drag all your photos onto the simulator window and they’ll save to camera roll automatically. You can do as many at a time as you want.
Update 2:
So I copy the photo to 100APPLE, like mentioned above.  Now the photo seems to be there forever.  Even if I remove everything, the default stuff shows up, but when the simulator is run (invoked using Appium) the photos I previously manually added, reappear inside the phone Simulator.  If I launch the phone Simulator manually the photos aren’t there, so there is an Appium factor that I am unware of/not sure how it works.  Found out the image copy issue, it is all on me, not knowing all the parts of the interconnected system I inherited – education is good 🙂
 Update 3:
A bit clunky, but command line nuking the image files in a folder while the iPhone Simulator is running
find ~/Path to Devices/(GUID of Device)/data/Media/DCIM/100APPLE/ -iname “*.jpg” -delete
Example:
find ~/Library/Developer/CoreSimulator/Devices/6A0CB955-C22B-48A6-A7F5-809806EB57F2/data/Media/DCIM/100APPLE/ -iname “*.jpg” -delete
Advertisements

Get a file listing from the Android Device (sdcard)

You can push or pull files from the device, but to get a file listing just shell to the device (for me I needed a listing of what I had pushed to the sdcard, since it has been a while since I worked with a particular device)

adb shell <enter>

prompt changes to $

cd sdcard <enter>

then ls <enter>

results:

ls
LOST.DIR
Android
DCIM
download
media
upload_avatar.jpg
login_5304301725.txt
testMonkey.txt

To nuke (delete/remove) a file rm <filename>

Note:

Tab completion doesn’t work (at least on my windows machine with just the Android SDK installed)

And there is confirmation when you hit enter the file is gone

Then you can get out of the shell by typing exit