How To Push Video on iPhone Simulator? - iphone

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.

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!

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.

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.

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 or VID_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

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.

Related

App icon not showing up on iPhone 5 device during testing

I have a 120x120 icon image that's working fine on emulators - however when I try it on my device, the icon doesn't show up. Any thoughts?
I figured it out. This was actually really annoying. So the UI designer had simply renamed his .psd files with .png and xcode thought this was fine. However, renaming the .pngs isn't going to automatically make them real .pngs. The way I solved this was going to mac preview and exporting the files to the PNG format.
Sometimes some of the images get cached by the OS.
Delete your app completely from your mobile device (press and hold, then delete the app)
Turn off your device and turn it on again.(This ensures that the cache gets cleared)
In xCode, clean the project and rebuild.
Load the software again you your device.
You should be able to see your icon as long as its properly added to your project.
Drag your app over another app to group both into a folder. Then drag the app out of the folder.
Check your info.plist file. Make sure the icon entry looks something like this (use your own image file names of course):
If you see another "Icon already includes gloss effects" row outside, remove it.
It is not uncommon not to see your app icon on the device. However, when your app is being uploaded to the App Store, everything will be fine.
Is your iOS device running iOS7? If not, you will need to include 57x57 and 114x114 icons as well. See https://stackoverflow.com/a/18737063/1646862 for icon sizes apple requires. It is always good to include all icon sizes you may need in your iOS bundle.

adding image to library in iphone simulator

I've done some research on this issue for the past hour. It should be an easy issue, but I still can't get it to work. I've added an image called IMG_0000.JPG in ~/Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE and ~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE. People say the easy way out is to drag an image from safari to the library. I did that and it opens the image in safari, but when I try again the image is not there. What should I do?
When they are talking about adding the image from Safari, it is actually adding it in Safari from the simulator.
Open Safari on your iPhone simulator, go open the image you want and make a long press on the image. An option to save the image should appear.

How do I get video into the iPhone simulator camera roll in iOS 4.2?

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.
I found a way that seems to work in most versions of the simulator (confirmed for 6.1):
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!
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.
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.
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.
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 To Camera Roll'
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
Sign in to your iCloud account from the simulator. Sync your phone photos and videos with iCloud. They will simply appear.

ios4 photo library path on simulator

I have an app need to load photos from simulator photo library.
After I upgrade ios4, the photo library is empty.
So I have to add the photos manually.
But I can not get the path relates to the photo library on simulator.
Is there anyone know this?
Welcome any comment
Thanks
interdev
you can open a webpage and hold down your mouse to save it
the path in which all the photos saved is:
/Users/USERNAME/Library/Application
Support/iPhone Simulator/4.1/Media
4.1 or which sdk you are using
//EDIT:
I tested it with the first option and it saves all the pictures in DCIM/100APPLE/ but it also create the folder PhotoData/100APPLE/ where for each picture a .BTH and .THM is saved.
So the easiest way is to drag and drop a image on the simulator. The Simulator will open a webpage to your local file ("file://…") and then you can save it but holding your mouse key for 3 seconds or so.
Then click "save image" and it should appear in your Photo Library.
I find this free app very useful to batch import pictures into the simulator:
http://aptogo.co.uk/2010/09/importing-photos/
If it doesn't work straight away, follow the Reset Content instructions (warning - this will completely reset all apps and data on the simulator), and as long as you have a photo in the Photos app before you do it, it does work well.

How to add images to iphone simulator v4

I've always been able to get images into iphone simulator 3 by the usual methods described on this site (i.e. dragging image into iphone simulator).
However, having upgarded to the new xcode 3.2.3, although I can still save images to the simulator, I can't actually see them there when I go to the library on the simulator.
Thankfully - it works when I build for the iPad simulator.
Has anyone else go this problem or is my install of the new xcode screwy?
I've noticed that you can add them if you change the device in the Hardware menu. Switch to iPhone and do the usual. Then switch back to iPhone4 and you'll be able to see the images in the photo library.
alt text http://img.skitch.com/20100705-8kra9hetayjqhyu3i5w4brayr4.png
You should also file a radar with Apple. ;-)
I was had the same problem after v4 upgrade but it seems to work if I drag the images into an album in the actual 'photos' app.
You can save images in the simulator by going to Safari on the iPhone,iPad.
Navigate to some URL eg, hot pictures of Megan Fox on google images. Click and hold on your favourite image of here, hopefully in a very hot pose. Then select save from the menu that appears.
This normally does it for me.
[UPDATED]
Sorry this does not work on 3.2.2 but has worked in the past.
Seems that you need to run the Photos app on the simulator after dragging in images in order for it to make the images available from your app.
First you simply run simulator then tap on back button after this drag image from your macbook u found small image on simulator screen hold courser on image
after a while bring a pop-up screenView on iPhone simulator screen to ask that you want to save this image or cancel
you just save and go back
open photo gallery you must be see one image in photo gallery