问题
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.
回答1:
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.
回答2:
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:
- Start up the simulator and navigate to the photos app from the home screen.
- Drag and drop an
.m4v
file from your file system onto the simulator window. The video will now be playing in safari. - Click "done" in the upper left hand corner.
- Click on the "share" button and select "save to camera roll"
You're done!
回答3:
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.
回答4:
Follow the below steps;
/Users/UserName/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE
- Copy your video file rename it to
VID_0001.m4v
orVID_0001.mov
- Remove
PhotoData
from/Users/UserName/Library/Application Support/iPhone Simulator/6.1/Media/PhotoData
- Restart your simulator, video will show under Saved photos
回答5:
Short answer:
- 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:
- Make sure your movie file type is supported by the iPhone.
- Open the Library under your user. (YourUserName/Library) If you can't find the file, it is hidden. Make it visible or use Terminal.
- 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)
- 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.
- 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.
来源:https://stackoverflow.com/questions/1287622/how-to-push-video-on-iphone-simulator