Can anyone tell me how to add video the iPhone simulator so that I can test some apps I am working on? Thanks in advance!
-
1Use MPMoviePlayerController for video playing purpose in iphone. You will find help about it in Apple Documentation. – Mobile Developer iOS Android Jun 16 '11 at 11:50
-
2Just a note: to add a PHOTO easily to the simulator: (1) drag the photo to the simulator (2) note that it opens in SAFARI (3) HOLD DOWN on the photo, then you can save it to the photo.app. In fact **videos work the same way but** you can't play them, it seems. – Fattie Dec 01 '13 at 14:38
12 Answers
It's very simple you just drag any .MOV file to your simulator. Now it will be opened in Safari browser. At top left corner there is a 'Done' button. You just have to press it after this you can press Share button then just choose the option save video and it's done. Now play it in your app. :)

- 8,847
- 4
- 67
- 72

- 873
- 8
- 14
-
11You, sir, deserve WAY more up votes. Easiest solution on this page. (Works with XCode 6/iOS 8 Simulator) – Cutetare Aug 23 '14 at 09:34
-
1What the fcuking fcuk! I'm sure Apple must've thought, "Hey that's so intuitive that all iOS devs cant help noticing" – Kedar Paranjape Jul 16 '15 at 10:01
-
Worked also with a mp4 file. I really love you so much right now. I was struggling 1 hour (was about to build a temp download for that). Such a simple solution! BTW, on iOS 9, the video just got saved into the camera roll. Didn't had to do anything. – Hirbod Aug 24 '16 at 01:16
-
Thanks for this! I knew that's how it works and tried with multiple mp4 files. (Maybe they're no longer supported with Xcode 10?) But MOV files worked :) – Alex Wally Dec 07 '18 at 04:47
-
I have tried doing extactly this but is does not work (simulator 11(13.4.1)). the following error comes up: One or more media items failed to import: /Users/me/Downloads/testVid.m4v: The operation couldn’t be completed. (PHPhotosErrorDomain error -1.) – jamesMcKey May 06 '20 at 09:25
-
2Thank-you! When .mov file was dropped on simulator, it went right into Photos. So easy. Confirmed on simulators-> iPhone SE (2nd) (13.4.1) and iPhone 11(13.4.1) – Marcy May 16 '20 at 15:39
-
@jamesMcKey, I dragged an .mp4 (codec H.264) from my desktop onto the iPhone 11 simulator(13.4.1) and it worked. The .mp4 file went immediately into Photos. You might try another file. – Marcy May 16 '20 at 15:48
-
If you get the error "Operation couldn't be completed..." move you file from Downloads to ~ first. I don't know, but dragging from Downloads folder not working for me. – Pavel Shorokhov May 02 '23 at 12:36
I did the same as you do with images, drag dropped the video onto the iOS simulator not just photo's app but any app can be running on it at the time you drag drop.
Step 1: Drag drop.
Step 2: iOS simulator opens up safari to play the video file.
Step 3: Click on the share icon to get the Save Video option in the action's list.
But clicking on Save Video action for so many times nothing happens and nothing gets added to the albums. Any ideas? Even tried copy pasting the video file to the simulator's DCIM path.

- 10,998
- 6
- 50
- 93
okey, try this:
- (void) downloadVideo {
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://sepwww.stanford.edu/sep/jon/trash/poolwaves.mov"]];
You can change the temp.mov to temp.m4v to save the vid in m4v.
NSString *tempPath = [NSString stringWithFormat:@"%@/temp.mov", NSTemporaryDirectory()];
[imageData writeToFile:tempPath atomically:NO];
UISaveVideoAtPathToSavedPhotosAlbum (tempPath, self, @selector(video:didFinishSavingWithError: contextInfo:), nil);
}
- (void) video: (NSString *) videoPath
didFinishSavingWithError: (NSError *) error
contextInfo: (void *) contextInfo {
NSLog(@"Finished saving video with error: %@", error);
}
if you change the url to your moviefile, this should work really well...
the movies are saved in this directory: /Library/Application Support/iPhone Simulator/4.3.2/Media/DCIM
but you are right, if i copy a file to it, it won't show up in the simulator
greets

- 720
- 5
- 10
-
Hi @Schnarchii ,it is not working for me. have copy a .m4v video and pasted in this path ~/Library/Application Support/iPhone Simulator/4.3.2/Media/ – Rani Jun 16 '11 at 12:53
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 on the iPhone. I used a .mov
- Open the Library. (YourUserName/Library) If you can't find the file, it is hidden. Make it visible or user Terminal.
- Navigate to ~/Library/Application Support/iPhone Simulator/ 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.

- 1
- 1

- 8,847
- 4
- 67
- 72
-
-
Try the long answer. :) Did you find the correct files? What version of Xcode and the simulator are you using? – Joshua Dance Jul 26 '13 at 21:53
-
I used both way, but non of this help me to display video in my simulator, my system is ,, `Xcode - 4.6.2 , iOS - 6.1, simulator - 6.0` – Jul 27 '13 at 04:39
-
Okay .. i got other way for add video in simulator ..http://stackoverflow.com/questions/16455958/how-to-add-videos-in-iphone-6-0-simulator/16456019#16456019 – Jul 27 '13 at 04:58
-
1Working on Xcode 5.0.2. I needed to delete PhotoData folder like Joshua suggested. – Genki Jan 11 '14 at 18:57
You can add Your file by adding these 2 lines of code in appdelegate.m
NSString *path = [[NSBundle mainBundle] pathForResource:@"sample_iTunes" ofType:@"mov"];
UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);`

- 83
- 7
For 2022, if you try to import a .mov file directly from the Downloads folder the simulator gives a vague error (PHPhotosErrorDomain error -1). To solve this move the video into your root /~ directory and drag it into the simulator.
XCode Version - 13.2
Simulator iOS Version - 15.2

- 96
- 1
- 3
go to following path and past video
/Users/"username"/Library/Developer/CoreSimulator/Devices/11BFF1F0-2A2B-409A-9727-3267D71E10D4/data/Media

- 328
- 1
- 8
-
-
1./Users/SandeepKumar/Library/Developer/CoreSimulator. 2.find name of the device in device.plist like "iPhone 6". 3. go to data/Media 4. Past Video. – Sandeep Kumar Mar 16 '16 at 05:03
-
If you're asking how to add video to your app the simple way to show video using MediaPlayer.h
lib.
// fileURL is a NSURL made from file path in app bundle
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL: fileURL];
[[mp view] setFrame:CGRectMake(0,0,100,100)];
[mp play];
You should set many parameters for mp object: scaling, controls, etc.

- 3,245
- 7
- 55
- 84
-
i dont want to add video to my app.Initially i want to add it to the iphone simulator to test my app – Rani Jun 16 '11 at 11:43
-
1Where to? There is no "main storage" or SD card on iphone, just apps' documents folders. They're under the paths like /Users/MAC_USER/libraries/application support/iPhone Simulator/4.1/Applications/ – yosh Jun 16 '11 at 11:50
-
OP didn't ask for how to play a video. He is asking how to add a video file to the simulator. This is useful if he is testing a program that needs to use the ImagePicker and his app needs videos instead of photos. – Joshua Dance Jun 27 '13 at 22:38
-
-
OP is not asking for "how to add video to your app" he was asking "how to add video the iPhone simulator so that I can test some apps" :) – Joshua Dance Jul 01 '13 at 16:19
You need to add video in your application bundle itself. Later you can copy that to the documents directory.

- 28,260
- 49
- 182
- 256
-
Hi @Rahul , i have added .m4v video in my application bundle.But it does not show video in my simulator to check whether my video is working or not – Rani Jun 16 '11 at 12:55
-
It's been a while... Drag and drop somehow didn't work for me with video file (for both .mov and .mp4). So I adopted obj-c code from one of the answers
let path = Bundle.main.path(forResource: "Video", ofType: "mov")!
UISaveVideoAtPathToSavedPhotosAlbum(path, nil, nil, nil)

- 680
- 7
- 21
In 2022, just drag and drop a video (screen recording on your mac for example) to the iphone simulator and it will be there in the Photos

- 783
- 9
- 17