Simulator App Preview Video pixelated - ios

I'm using the simulator to generate an App Store Preview video with the following command:
xcrun simctl io booted recordVideo ~/Desktop/test.mp4
It generates a video, but I get a lot of weird artifacts when I play the video. If I pop it into iMovie, it get's completely distorted and it just see green/blue frames.
Anyone having ideas?

I could solve the problem by opening the mov file in quicktime and by re-exporting it from there again. The strange artifacts in the video disappeared.

Related

WebRTC iOS 13 Simulator - Red Screen H264 Decoding

My problem is that H264 WebRTC Video is playing on iOS 13 in real device as expected.
But it does not play in iOS 13 simulator. It shows red screen as shown in the image.
Audio is playing correctly. Logs also show that decoding of frames are succesful at correct rate.
GoogleWebRTC version is 1.1.29229 from cocoapods
I got the same issue in our app.
It seems to be a bug on the WebRTC side.
I was able to reproduce it in their test app (AppRTCMobile), and posted a bug report about it here:
https://bugs.chromium.org/p/webrtc/issues/detail?id=11012
Please star it there :)
In the meantime it seems that forcing the codec to VP8 should fix the problem on the simulator (as a temporary workaround).

Record IOS Simulator video and simulator audio in background

I need to record 100 separate videos of my simulator which is about 40 hours of high quality. I want to record video of Xcode simulator and system audio in the background. Since I need to use my computer at the same time I don't want to use tools like Camtasia or quick time. I am wondering if this is achievable. If so this will save my one month.
In the latest version of Xcode Simulators "Scroll over the Save Screen Button and Hold the OPTION key , gives the screen record option.
Save screen button will change to record video button
You can achieve this by following.
1.In simulator Menu Choose Hardware > Audio Input > System to use the same audio input as the Mac.
2.Open Terminal and navigate to the directory where you want to save video.
Run Command : xcrun simctl io booted recordVideo <filename>.<extension>
It will start recording.To finish Press Control-C. Video will save on current directory.

Capture iOS Simulator video for App Preview

Okay, so we can now submit video previews of our apps on the App Store. According to Apple we should do so with an iOS8 device and OSX 10.10. The problem is you have to have all the different devices (4", 4.7", 5.5" and iPad).
Is there an alternative to this?
I am thinking of capturing a video of the simulator. The problem is the device screen is bigger than my FullHD monitor when shown in 100% resolution. Any solution that can capture a video right from the simulator in full resolution?
Edit:
Since a lot of people are answering questions I'm not asking let me say:
- Recording one device size and scaling it is not what I'm asking;
- How to record any app preview is not what I'm asking;
- How you do your previews is not what I'm asking;
What I am asking is can you record a video from the simulator in 100% resolution if it doesn't fit on the screen?
For Xcode 8.2 or later
You can take videos and screenshots of Simulator using the xcrun simctl, a command-line utility to control the Simulator
Run your app on the simulator
Open a terminal
Run the command
To take a screenshot
xcrun simctl io booted screenshot <filename>.<file extension>
For example:
xcrun simctl io booted screenshot myScreenshot.png
To take a video
xcrun simctl io booted recordVideo <filename>.<file extension>
For example:
xcrun simctl io booted recordVideo appVideo.mov
Press ctrl + C to stop recording the video.
The default location for the created file is the current directory.
Xcode 11.2 and later gives extra options.
From Xcode 11.2 Beta Release Notes
simctl video recording now produces smaller video files, supports HEIC
compression, and takes advantage of hardware encoding support where
available. In addition, the ability to record video on iOS 13, tvOS
13, and watchOS 6 devices has been restored.
You could use additional flags:
xcrun simctl io --help
Set up a device IO operation.
Usage: simctl io <device> <operation> <arguments>
...
recordVideo [--codec=<codec>] [--display=<display>] [--mask=<policy>] [--force] <file or url>
Records the display to a QuickTime movie at the specified file or url.
--codec Specifies the codec type: "h264" or "hevc". Default is "hevc".
--display iOS: supports "internal" or "external". Default is "internal".
tvOS: supports only "external"
watchOS: supports only "internal"
--mask For non-rectangular displays, handle the mask by policy:
ignored: The mask is ignored and the unmasked framebuffer is saved.
alpha: Not supported, but retained for compatibility; the mask is rendered black.
black: The mask is rendered black.
--force Force the output file to be written to, even if the file already exists.
screenshot [--type=<type>] [--display=<display>] [--mask=<policy>] <file or url>
Saves a screenshot as a PNG to the specified file or url(use "-" for stdout).
--type Can be "png", "tiff", "bmp", "gif", "jpeg". Default is png.
--display iOS: supports "internal" or "external". Default is "internal".
tvOS: supports only "external"
watchOS: supports only "internal"
You may also specify a port by UUID
--mask For non-rectangular displays, handle the mask by policy:
ignored: The mask is ignored and the unmasked framebuffer is saved.
alpha: The mask is used as premultiplied alpha.
black: The mask is rendered black.
Now you can take a screenshot in jpeg, with mask (for non-rectangular displays) and some other flags:
xcrun simctl io booted screenshot --type=jpeg --mask=black screenshot.jpeg
Using xcrun simctl:
xcrun simctl io booted screenshot <filename>.<file extension>
Using Screen Capture:
Use cmd + shift + 5 and the resize the selection so that the simulator is recorded.
Using QuickTime Player:
You can use QuickTime Player to record the screen.
Open QuickTime Player
Select File from the menu
Select New Screen recording
Now from the Screen Recording window, click on the record button.
It will provide you with an option to record the entire screen or a selected portion of your screen.
You will have to make a selection of your simulator so that only the simulator portion will be recorded.
You can record a portion of the screen with built-in screenshot utility:
Press Shift-Command-5 to show a control panel.
Select .
Select a portion of the screen you want to record. That would be the iPhone simulator.
Click to stop recording.
A thumbnail will appear at the bottom right corner of the screen. You can edit it before saving.
If you want to visualize mouse clicks, after step 1 select Options control and enable Show Mouse Clicks.
Apple recommends doing so on an actual device and has a guide on how to do this using QuickTime and iMovie on iOS and OS X:
https://developer.apple.com/app-store/app-previews/imovie/Creating-App-Previews-with-iMovie.pdf
Summary:
Capture Screen Recordings with QuickTime Player
Connect your iOS device to your Mac using a Lightning cable.
Open QuickTime Player.
Choose File > New Movie Recording.
In the window that appears, select your iOS device as the Camera and Microphone input source.
Create an App Preview with iMovie
Import Screen Recordings
Next, you import the screen recording files that you captured with QuickTime Player into iMovie.
In iMovie:
Choose File > Import Media.
In the window that appears, select the screen recording files.
Create an App Preview Project
To start a new app preview project, choose File > New App Preview. A timeline appears where you can add and arrange clips to create your preview.
I'm actually surprised no one provided my answer. This is what you do (this will work if you have at least 1 eligible device):
Record, edit and finish the App Preview with the device you have.
Export as a file.
Go to your Simulators and print screen 1 shot on each of the different sizes of iPhones.
Create a new App Preview in iMovie.
Insert the screenshot of the desired size FIRST, then add the file of the App Preview you've already made.
Export using Share -> App Preview
Repeat steps 4 to 6 for new sizes.
You should be able to get your App Preview in the desired resolution.
Using the new release of Xcode 12.5 you can simply record the simulator screen using ⌘ + R. For details you can visit here.
You should use QuickTime in Yosemite to connect and record the screen of your iOS devices.
iPhone Portrait
When you have finished the recording, you can use iMovie to edit the video. When you're working on an iPhone Portrait App Preview, the resolution must be 1080x1920 but iMovie can only export in 16:9 (1920x1080).
One solution would be to import the recorded video with the resolution 1080x1920 and rotate it 90 degrees. Then export the movie at 1920x1080 and rotate the exported video back 90 degrees using ffmpeg and the following command
ffmpeg -i Landscape.mp4 -vf "transpose=1" Portrait.mp4
iPad
The iPad is a little bit trickier because it requires a resolution of 1200x900 (4:3) but iMovie only exports in 16:9.
Here is what I've done.
Record the movie on iPad Air in Landscape (1200x900, 4:3)
Import into iMovie and export as 1920x1080, 16:9 (iPadLandscape16_9-1920x1080.mp4)
Remove left and right black bars to a video with 1440x1080. The width of one bar is 240
ffmpeg -i iPadLandscape16_9-1920x1080.mp4 -filter:v "crop=1440:1080:240:0" -c:a copy iPadLandscape4_3-1440x1080.mp4
Scale down movie to 1220x900
ffmpeg -i iPadLandscape4_3-1440x1080.mp4 -filter:v scale=1200:-1 -c:a copy iPadLandscape4_3-1200x900.mp4
Taken from my answer on the Apple Developer Forum
Taking a Screenshot or Recording a Video Using the Command Line
You can take a screenshot or record a video of the simulator window using the xcrun command-line utility.
Launch your app in Simulator.
Launch Terminal (located in /Applications/Utilities), and enter the appropriate command:
To take a screenshot, use the screenshot operation:
xcrun simctl io booted screenshot
You can specify an optional filename at the end of the command.
To record a video, use the recordVideo operation:
xcrun simctl io booted recordVideo <filename>.<extension>
To stop recording, press Control-C in Terminal.
Note: You must specify a filename for recordVideo.
The default location for the created file is the current directory.
For more information on simctl, run this command in Terminal:
xcrun simctl help
For more information on the io subcommand of simctl, run this command:
xcrun simctl io help
From Apple Documentation.
You can do this for free with the following tools. You will need at least one real device (I used an iPhone 5).
Capture the video with the simple, but excellent appshow (note this is a very barebones tool, but it's very easy to learn). This will export at the native device resolution (640x1136).
Resize with ffmpeg. Due to rounding, you can go directly between the resolutions, but you have to oversize and then crop.
ffmpeg -i video.mov -filter:v scale=1084:1924 -c:a copy video_1084.mov
ffmpeg -i video_1084.mov -filter:v "crop=1080:1920:0:0" -c:a copy video_1080.mov
For iPad, you can crop and then add a letterbox. However, cropping like this usually won't yield a video that looks exactly like your app does on the iPad. YMMV.
ffmpeg -i video.mov -filter:v "crop=640:960:0:0" -c:a copy video_640_960.mo
ffmpeg -i video_640_960.mov -filter:v "pad=768:1024:64:32" -c:a copy video_768_1024.mov
ffmpeg -i video_768_1024.mov -filter:v scale=900:1200 -c:a copy video_900_1200.mov
The Apple's Simulator User Guide states in Taking a Screenshot or Recording a Video Using the Command Line paragraph:
You can take a screenshot or record a video of the simulator window using the xcrun command-line utility.
To record a video, use the recordVideo operation in your Terminal:
xcrun simctl io booted recordVideo <filename>.<extension>
Note that the file will be created in the current directory of your Terminal.
If you want to save the video file in your Desktop folder, use the following command:
xcrun simctl io booted recordVideo ~/Desktop/<filename>.<extension>
To stop recording, press Control-C in Terminal.
This is the way I found easiest and you only need one iPhone and iPad:
Record device screen with QuickTime Player:
Connect your device.
Open QuickTime Player.
Choose File > New Movie Recording (CMD + alt + N)
In the window that appears, select your iOS device as the camera with maximum resolution.
Save video file (CMD + S)
Open iMovie
Select File -> New App Preview
Drag an IMAGE from your app with the biggest resolution ex. a 1920 x 1080 screenshot to the project. (This makes the video 1920 x 1080 even if you recorded with an iPhone 5)
Drag the movie you recorded to the project.
Save by choosing File -> Share -> App Preview
Now do this with all of your devices or:
Download Handbrake: https://handbrake.fr/downloads.php
And resize the high res video:
Drag your high res video to Handbrake
Select the "Picture Settings" icon
Resize to the correct size - close and press "Start" icon - gets saved to the desktop
As of Xcode 13, you can directly start screen recording from the simulator in full resolution :
1.
Or Press Command + R
Press escape or the recording button to stop the recording
The recorded video is in the device resolution, so it has to be resized to the App Store Preview resolutions (886x1920, 1080x1920, 1600x120 etc)
The aspect ratio of the iPhone 6.5 Inch is not exactly the same as the required App Store preview resolution so makes sure it is 886x1920 or 1920x886 when you export it.
With Xcode 12 just press cmd + R in the simulator to record the screen. cmd + S to take a screenshot.
From Xcode 9 and on you can take screenshot or record Video using simctl binary that you can find it here:
/Applications/Xcode.app/Contents/Developer/usr/bin/simctl
You can use it with xcrun to command the simulator in the command line.
For taking screenshot run this in command line:
xcrun simctl io booted screenshot
For recording video on the simulator using command line:
xcrun simctl io booted recordVideo fileName.videoType(e.g mp4/mov)
Note: You can use this command in any directory of your choice. The file will be saved in that directory.
As of today in 2019, Apple has made life much easier for low budget or one-man project developers like me.
You can just use the terminal command from one of the above posts to record videos from the wanted device simulator. And then use iMovie's New App Preview feature.
xcrun /Applications/Xcode.app/Contents/Developer/usr/bin/simctl io booted recordVideo pro3new.mov
iMovie -> File -> New App Preview
Here is a solution that works and doesn't cost $300 (FinalCut Pro), but it does require ScreenFlow (ScreenFlow app in AppStore) ($100):
Hookup your device to a Mac running Yosemite
Launch Quicktime and select File/Newi Movie Recording
Launch ScreenFlow and capture your video
Edit your video inside ScreenFlow (add text, music, etc)
Crop the video so that it only contains the device screen
Export the video with the size required by Apple (e.g., 1334x750)
The best tool I have found is Appshow. Visit http://www.techsmith.com/techsmith-appshow.html (I do not work for them)
A tip for users who like to use ZSH functions. You can simplify things a little by adding a function that does the same thing as #Tikhonov Alexander's answer.
Start out by typing:
edit ~/.zshrc
into your terminal.
Then add this function someplace in the file.
function recsim() {
echo -n "Use CTRL+C to stop recording";
xcrun simctl io booted recordVideo --codec=h264 --mask=black "$1.mp4";
}
To use, type something like:
recsim appPreview
into your terminal window. Note: Terminal must be restarted after adding the function before it will work.
This function is adapted from Antoine Van Der Lee's blog post on how to do this in bash, which can be found here.
For Apple TV Simulator (tvOS, AppleTV) you should add --display=external parameter. I use this to save to desktop:
xcrun simctl io booted recordVideo --display=external --codec=h264 --force ~/Desktop/SimulatorVideo.mov
--force to rewrite if file exist
--codec to higher framerate
You can use the QuickTime screen recording and the iOS Simulators to do your video recordings. The tricky thing here is to get the correct size so that iMovie can detect the output resolution when you go to export the AppPreview. I haven't found a way to select the output res in iMovie so if must detected by the format of the media you are using. It may take you several tries but it's doable. It's one of those: do I have $300 for FinalCut Pro or do I have an hour or so of my time? You only need three recordings as mentioned above. I could actually do two of them on devices because I have them but I don't have an iPhone 6 (yet ... :) ). I also like the simulators because you can use something like SimFinger to simulate gestures and pressing of buttons.
Good luck!
I was facing the same problem. It has a very simple solution that worked for me. Just follow these steps:
1.Make a preview video in iMovie.
2.Export video using share file option. Choose 1920x1080 as it can be used for 5S, and 6 plus.
3.Download Appshow for Mac by techsmith (https://www.techsmith.com/techsmith-appshow.html.) It is specially made for making app preview videos. But i don't recommend it for making videos but rather just for exporting.
4.Choose a new App Preview video and customise it by choosing fewer frames which you can later delete.
5.Import your iMovie video into this template. On the top right corner you can choose any resolution you want, appshow has all the resolutions required for app preview.
6.Finally, just choose the device and export the video in your selected resolution.
In my MBP's Settings > Displays > Display, I see a setting for 'Resolution: Default for Display / Scaled'. I set it to 'More space', then try the various simulators, all of which seem to fit on the enlarged screen at 100%. I suspect that wouldn't work with your FullHD screen though...
An alternative might be to try to install some sort of VNC server solution on the simulator, like https://github.com/wingify/vnc, and record that with a VNC recorder - I believe there's a Python VNC recorder out there.
I've created RocketSim for this reason. It comes with a UI to start the recording and converts the recording into the right format requirements for App Previews.
You can simply drag the recording into App Store Connect and it simply works. An example of this can be found here.
Unfortunately, the iOS Simulator app does not support saving videos. The easiest thing to do is use Quicktime Player to make a screen recording. Of course, you'll see the mouse interacting with it which is not what you want, but I don't have a better option for you at this time.
You can combine QuickTime Player + iMovie(Free)
At first choose your desired simulator from xcode and record screen using QuickTime Player. After that use iMovie for making App Preview and finally upload the video with Safari browser.It's simple... :)

Changing video quality based on device using MPMoviePlayer

I used an MPMoviePlayer to play an .mp4 video within my app, which works fine. I tried my app on an Android device using Apportable but the video wasn't playing till I later realized that it was because the video quality was too high for the device. Is it possible to change the video quality (of an .mp4) based on the device running the app using MPMoviePlayer? If yes, how can this be done?
If you simply have one video that plays on iOS and one that plays on Android via Apportable, you could opt to simply have two files of the same name where one file is added to the project and attached to the iOS build target and the other is attached to the Apportable build target.

Adding images or videos to iPhone Simulator

I am trying to use UIImagePickerController with UIImagePickerControllerSourceTypePhotoLibrary, but it says, "No photos". Where does the simulator get the images from? Where should I copy the images so that they are displayed in the simulator?
Explain step by step of Airsource Ltd's answer for adding image to simulator:
Drag it to simulator, then Safari opens
(or browse to the Image in the internet using Safari)
Hold your click on the image
When the pop-up appears, choose Save Image and enjoy ;)
Update: for iOS Simulator 4.2, do these steps twice to get it work. Thanks kevboh!
Update: This also works for iOS Simulator 6.1
The simplest way to get images, videos, etc onto the simulator is to drag and drop them from your computer onto the simulator. This will cause the Simulator to open the Photos app and start populating the library.
If you want a scriptable method, read on.
Note - while this is valid, and works, I think Koen's solution below is now a better one, since it does not require rebooting the simulator.
Identify your simulator by going to xCode->Devices, selecting your simulator, and checking the Identifier value. Or you can ensure the simulator is running and run the following to get the device ID xcrun simctl list | grep Booted
Go to
~/Library/Developer/CoreSimulator/Devices/[Simulator Identifier]/data/Media/DCIM/100APPLE
and add IMG_nnnn.THM and IMG_nnnn.JPG. You will then need to reset your simulator (Hardware->Reboot) to allow it to notice the new changes. It doesn't matter if they are not JPEGs - they can both be PNGs, but it appears that both of them must be present for it to work. You may need to create DCIM if it doesn't already exist, and in that case you should start nnnn from 0001. The JPG files are the fullsize version, while the THM files are the thumbnail, and are 75x75 pixels in size. I wrote a script to do this, but there's a better documented one over here(-link no longer work).
You can also add photos from safari in the simulator, by Tapping and Holding on the image. If you drag an image (or any other file, like a PDF) to the simulator, it will immediately open Safari and display the image, so this is quite an easy way of getting images to it.
3 Simple Steps
Drag & Drop image onto simulator
- this will open a browser with your image
Click & hold image
- this will open options
save image
- this will copy image onto simulator
Watch YouTube Video ( add images to iphone simulator)
With iOS 8.0, we added the ability to just drag and drop images into the iOS Simulator. You can drag a bunch of images into the window, and they should be imported into the photo reel for that simulated device. You can also do this with the simctl command line tool. 'xcrun simctl addphoto '
Since Xcode 6 you can use the command line tool xcrun simctl.
Usage is very simple; to add a photo to the currently running simulator you use the booted placeholder.
xcrun simctl addmedia booted ./MyFile.jpg
To add it to any other simulator, you use its device id, which can be found by running xcrun simctl list.
xcrun simctl addmedia E201E636-CE6C-11E5-AB30-625662870761 ./MyFile.jpg
Its simple. Just follow these steps :
Drag and drop image onto Simulator
Now image opens into Safari browser (file://.../ImageName). Tap-and-hold on the Image.
This displays actionSheet with Save, Cancel option (Also copy in case of iOS 7 simulator).
Save the image. The image gets added into Library.
I just stumbled upon how to bulk upload images on the iOS Simulator. (I've only confirmed it on 6.1.)
Backup the folder:
~/Library/Application Support/iPhone Simulator/6.1/Media
Copy all your images into the folder:
~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE
Move or delete the folder:
~/Library/Application Support/iPhone Simulator/6.1/Media/PhotoData
Restart iOS Simulator
Open the Photos app
The simulator will restore all the images from the 100APPLE folder!
For iOS 7 I did the following:
copy photos to these two folders:
~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE
~/Library/Application Support/iPhone Simulator/7.0/Media/DCIM/100APPLE
delete these 4 files only (to avoid duplicates on relaunch):
~/Library/Application Support/iPhone Simulator/6.1/Media/PhotoData/Photos.sqlite-shm
~/Library/Application Support/iPhone Simulator/6.1/Media/PhotoData/Photos.sqlite-wal
~/Library/Application Support/iPhone Simulator/7.0/Media/PhotoData/Photos.sqlite-shm
~/Library/Application Support/iPhone Simulator/7.0/Media/PhotoData/Photos.sqlite-wal
Just drag images to the iPhone simulator.
This is MUCH easier with the new iOS Simulator that comes with Xcode 6+ (iOS Simulator 8.1 and above.) Now all you have to do is drag one or more photos onto the iOS Simulator window, and instead of opening Safari, the Photos app opens, and instantly adds all dragged-in photos to the device.
Method 1 (Easiest Way): If you have your image on Mac
You can drag an image from the Finder on your Mac to Simulator, and it is saved to the Saved Photos album.
Method 2: If its on any URL
To save an image from a webpage to the Photos app
Place the pointer on the image you want to save, and hold down the mouse button or trackpad.
When the menu appears, click Save Image to save the image to the Photos app in an iOS simulator.
The image is saved to the Saved Photos album in the Photos app.
Incase someone looking for Apple Documentation regarding Copying and Pasting in Simulator.
If you can not drag and drop your files because you experience the error:
One or more media items failed to import: : The operation couldn’t be completed. (PHPhotosErrorDomain error -1.)
Move your files into the Documents folder and then drag them into the simulator. This will trigger the simulator to ask for permissions to access your files. Having them inside the Downloads folder, will not.
None of the answers had the exact solution that I needed.
The steps I've found for myself working on iOS 5.0 and above simulator are as follows:
Close the simulator if it is running xcode project.
Run simulator from the dock by clicking on it.
Drag & drop the image into simulator.
Tap and hold the image (opened in safari) and select the save option.
You are done.
For iOS 5.1 this is further changed to new path
~/Library/Application Support/iPhone Simulator/5.1/Media/DCIM/100APPLE
As of iOS 8, you can just drag all your photos onto the simulator window and they'll save to camera roll automatically. You can do as many at a time as you want.
None of the answers above worked for me on iOS 15.
I simply opened Files app and dragged and dropped the image there. It automatically imported the image to the Photos app and I was able to use everywhere through my simulator.
Cheers!
If you need to import more than just one or two photos then take a look at this article that I wrote. It describes an easy way to perform a bulk import of photos and works for iOS 4.x.
For iOS 8, If there is no need to retain photo capture date and location, just drop photo files to the simulator.
To retain photo meta data, do the following:
Copy photo files to: /Users/{USER}/Library/Developer/CoreSimulator/Devices/{UDID}/data/Media/DCIM/100Apple
Remove (or rename) folder: /Users/{USER}/Library/Developer/CoreSimulator/Devices/{UDID}/data/Media/photoData
Relaunch Simulator
Note: You need to replace {USER} with your user name and {UDID} with the UDID of the simulator. To find UDID for your simulator, from Terminal, run 'xcrun simctl list'.
quit the simulator.
Run simulator from the dock by clicking on it.
Drag & drop the image into simulator which you want to add.
it will open image in safari .
tap and hold the image and click the save option.
then open gallery and you will see the image which u had saved recently.
Adding an image to the Iphone Simulation running IOS 8.0 is even easier.
Drag your image to the simulator
IOS opens the Photo app and your image is now part of your collection.
No need to deal with Safari anymore
In OS X Catalina with Xcode 11 you have to do this differently.
First you MUST start the simulator. If you want to copy, say a photo to MULTIPLE simulated devices. Start all of them up. Then Right Click on a SINGLE (Multiple images will fail. ONLY does a single file.).
Share -> Simulator
A 'share sheet will pop-up. You must choose an active simulator in the combo box and hit send.
It will send one to many but NOT many to many of selected photos.
I hope this helps folks. Drag and drop was supported in the last versions of Xcode and OS X but not with OS X Catalina and Xcode 11.
While this IS in the directions it currently IS NOT working.
What DID work for me was to first import my images into iPhoto on OS X and then DRAG/DROP them from my OS X iPhoto and drop into the simulator. It would appear the drag/drop for photos into the simulator is CURRENTLY only working from OS X iPhoto. :-(
For iOS 4.2 I had to go and create the 100APPLE folder and restart the simulator, then it worked.
try this app I've made. download the code and run it in simulator https://github.com/cristianbica/CBSimulatorSeed
For iOS 8.0,the answer is out of date.I found the media resource in the following path:
~/Library/Developer/CoreSimulator/Devices/[DeviceID]/data/Media/DCIM/100APPLE
Using your pc just Send the image via your email
Open the IOS-Simulator then open the email and download the image
just click and hold the mouse on the image, and from the options that will be displayed
Then, it will be automatically saved to your iOS-Simulator's photo gallery
Just Drag and Drop image into iphone simulator. browser will open to show your image.
press on image until you not receive options to save Image. then Save image.
thats it :). you will see your image in to Photo app in your simulator....
I wrote a bash script to do this.
Check the link[1]
#!/bin/bash
# Imports pictures into all iOS simulators.
path_to_pic="src/ios/pictures/"
mkdir -p /Users/$(whoami)/Library/Application\ Support/iPhone\ Simulator/{5.0,5.1,6.0,6.1}/Media/DCIM/100APPLE/
find ~/Library/Application\ Support/iPhone\ Simulator/ -type d -name '100APPLE' -exec cp /Users/$(whoami)/$path_to_pic/* {} \;
[1] : https://gist.github.com/firesofmay/5194901
Just to tell you : KONG's solution also works on iOS 7 beta.
His solution was:
Drag the image to simulator, then Safari opens (or browse to the Image in the internet using Safari)
Hold your click on the image
When the pop-up appears, choose Save Image and enjoy ;)
I just needed some random images for testing, so this is how I did it.
I have the simplest solution in the world. Just open Safari in the simulator, go to Google images (or your own web or Dropbox URL), view an image, hold down the mouse button for 2 seconds, and you'll see "Save Image" - it will save right into the Photos library. Rinse and repeat.
an even easier way, is :
open safari on simulator > tap www.google.com
search for random photos "nature"
open each image, press on it and save it.

Resources