7

I would like to push a video into iPhone simulator to test video picking in UIImagePickerController. Is it possible to do that? And if it possible, could you please provide me with some advices?

Thanks.

laalto
  • 150,114
  • 66
  • 286
  • 303
Lyubomyr Dutko
  • 4,486
  • 7
  • 32
  • 39

5 Answers5

16

None of the other methods suggested here worked for me, but I found a way that works on the latest version (6.1) of the simulator:

  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!

Pwnosaurus
  • 2,058
  • 1
  • 19
  • 21
12

I made it easier: first, I recorded a sample screencast with QuickTime X and saved it for iPhone. then, I copied it to '~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/VID_0001.m4v' (maybe you'll need to create 100APPLE directory). relaunched iPhone simulator and saw my video under 'Saved Photos' in Photos.app. when I use UIImagePickerController, that video is there and I'm able to choose it.

If that helps, I use SDK 3.2.1 on 10.6.2.

Maulik
  • 19,348
  • 14
  • 82
  • 137
sgosha
  • 1,299
  • 12
  • 19
2

You can subclass UIImagePickerController to override its behaviour and provide your own view. If you do this, you can then call imagePickerController:didFinishPickingMediaWithInfo: and supply your own pre-recorded video. If you include a video actually recorded from an iPhone 3GS, the behaviour you get will be pretty damn similar to that of the actual device.

Of course, always always always test on a real device before shipping!

We use a subclass of CLLocationManager in a very similar fashion to give a better location simulation.

iKenndac
  • 18,730
  • 3
  • 35
  • 51
2

Follow the below steps;

  1. /Users/UserName/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE
  2. Copy your video file rename it to VID_0001.m4v or VID_0001.mov
  3. Remove PhotoData from /Users/UserName/Library/Application Support/iPhone Simulator/6.1/Media/PhotoData
  4. Restart your simulator, video will show under Saved photos
buræquete
  • 14,226
  • 4
  • 44
  • 89
SAHIL
  • 431
  • 6
  • 18
0

Short answer:

  1. Drop your video file into ~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE/ and maybe delete the PhotoData file in Media.

Long Answer:

  1. Make sure your movie file type is supported by the iPhone.
  2. Open the Library under your user. (YourUserName/Library) If you can't find the file, it is hidden. Make it visible or use Terminal.
  3. Navigate to ~/Library/Application Support/iPhone Simulator/ as sogosha said. If you have multiple iOS Simulators pick the one your are developing for currently. (I had 5.0, 5.1, 6.0 and 6.1)
  4. Navigate to ~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE/ and drop in your video file. If the 100APPLE directory doesn't exist, create it.
  5. Sometimes you have to delete the PhotoData file in Navigate to ~/Library/Application Support/iPhone Simulator/6.1/Media/ to force the Simulator to recognize the new file since you didn't add it through normal means.

Xcode 4.6.3 and MacOS 10.8.4 fyi. Haven't tried on Xcode 5.

Community
  • 1
  • 1
Joshua Dance
  • 8,847
  • 4
  • 67
  • 72