Question

I've tried the solution described here and here, namely copying a QuickTime movie to ~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/VID_0001.m4v, but this doesn't seem to do anything, and I'm guessing something's changed since iOS 3.2 to make it not work.

Note that I'd very much prefer a solution that doesn't involve adding code to my app, unless that really is the only way to do it.

ETA: I know that it's possible to include video files as a resource; what I want is to add video files to the camera roll -- as can be done with photos by (for instance) saving images from Safari -- so I can test functionality that involves picking media files.

Updated again: If somebody can definitively tell me it's not possible, with references, that would be helpful too.

Was it helpful?

Solution

For XC6 simulators, you can search for the simulator directory with this command-line command:

For example, if you want to find the directory with the "5s" device:

grep -r -e "5s" --include="device.plist" ~/Library/Developer/CoreSimulator/Devices

Once you have the folder, you can navigate to:

<your-sim>/data/Media/DCIM/100APPLE

and copy your files in there. When you launch the simulator, you should open the Photos app and it should "restore" the metadata for the media. If that's not the case, you can also remove the "Downloads" and "PhotoData" folders and relaunch the simulator.

OTHER TIPS

I found a way that seems to work in most versions of the simulator (confirmed for 6.1):

  1. Start up the simulator and navigate to the photos app from the home screen.
  2. Drag and drop an .m4v file from your file system onto the simulator window. The video will now be playing in safari.
  3. Click "done" in the upper left hand corner.
  4. Click on the "share" button and select "save to camera roll"

You're done!

This is what I had to do for Xcode 6.3.1 / iOS 8:

  • open Safari
  • enter the filepath to the m4v on your Mac's HD using the file:// protocol, e.g. file:///Users/brentd/Desktop/video.m4v.
  • Click Done
  • Click the share button
  • Choose "Save Video"

The video will now be in your camera roll.

Have you seen the solution by Shizam, here:

iphone - How do I add videos to iPad simulator?

It requires code, however.

In Xcode 10, you can just drag-and-drop the video(s) into the simulator. If the Photos app is not open already, it will open and show the videos right there alongside the built-in sample photos.

If you stick your MP4 file into the "Resources" group/folder in xcode the simulator will have access to it just like other local resources.

Below is an example on devx that illustrates playing a movie file from the resources group.

devx Example

I used the code solution in the end, but looking at the simulator folders afterwards, it's using a different naming strategy for the videos.

Maybe it will work if you save the file as:

~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/IMG_0001.M4V

this does not work ( does not open safari ) if you have an app installed on the simulator which has document .ext handler , it open's that app instead of safari, so just simply

  • open safari on the simulator
  • drag a video file from your desktop and drop it on the simulator's safari
  • Click 'Done'
  • Click 'Share'
  • Select 'Save Tp Camera Roll'

Sign in to your iCloud account from the simulator. Sync your phone photos and videos with iCloud. They will simply appear.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top