ios4 photo library path on simulator - iphone

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.

Related

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.

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

Iphone 4 Simulator, Set Background Image?

I noticed on Xcode 3.2.3 that of the three simulators available both the iPhone(water drops) and iPad(night sky) show background images. Is there a way to add a few photos to Photos so that I can set one as a backdrop.
NB: I tried dragging an image to Safari in the simulator and then clicking/holding and saving but the image does not show up in Photos.
Gary.
Tapping and holding on an image viewed in Safari allows you to add the selected image to the Photo application. When the message pop-up appears choose "Save Image". Quit Safari and go to the Photo application. The image should be in the camera roll.
I have tried this technique before and it has always worked for me.
Try putting some images in the following directory:
~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE
Create the 100APPLE directory if it doesn't already exist. Then add some images in the format of:
IMG_0000.JPG
IMG_0001.JPG
IMG_0002.JPG
IMG_0003.JPG
I think this might be case sensitive as well.

Sync image from iTunes to the iPhone simulator

I want to know how to sync images from iTunes to the iPhone simulator.
This worked for me with iOS4: at the simulator, click home, then click the Photos icon. Drag the image from your Mac onto the simulator screen. Then follow the instructions above: hold down the mouse click on the image until the popover comes up. Choose Save image. Verify by clicking back to Photos (on the simulator) and inspecting (the new) album "Saved Photos."
I spent a while looking into this, and my conclusion for now is that although the Photos app says:
"You can sync photos and videos onto
your iPad Simulator using iTunes."
it's probably not actually simulator-specific instructions, but a generic message of the form
"You can sync photos and videos onto
your {DEVICE_NAME} using iTunes."
Where {DEVICE_NAME} is determined by calling [[UIDevice currentDevice] model].
Drag the photo into the simulator. After the iPad Simulator opens the dragged-in image in Safari, press-and-hold the image until the popover comes up. From the popover, choose Save Image. This saves the image to your iPad Simulator photo library.
After the iPad Simulator opens the dragged-in image in Safari, press-and-hold the image until the popover comes up. From the popover, choose Save Image. This saves the image to your iPad Simulator photo library.
Open Photo Album in the iphone
simulator
Drag the image into it IT shall open the image in the browser
keep right click pressed on the image
an option with the "save image" shall appear
click on it And Viola.. you have it inside the Photo Album
If you need to import more than just one or two photos then take a look at this article. It describes an easy way to perform a bulk import of photos.
I'VE GOT IT! You must 'drag' the picture to the ipad simulator.
Unfortunately for people who regularly upgrade, the iPhone Simulator for iOS 4 does not have a Photo Album as far as I can see. None of the suggestions above works with it.

How To Push Video on iPhone Simulator?

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.