如何将视频添加到 iPhone 模拟器
谁能告诉我如何向 iPhone 模拟器添加视频,以便我可以测试我正在开发的一些应用程序?提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(13)
这非常简单,您只需将任何 .MOV 文件拖到模拟器中即可。现在它将在 Safari 浏览器中打开。左上角有一个“完成”按钮。您只需按一下即可
您可以按“共享”按钮,然后只需选择“保存视频”选项即可完成。现在在您的应用程序中播放它。 :)
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. :)
我对图像做了同样的操作,将视频拖放到 iOS 模拟器上,不仅仅是照片的应用程序,而且在拖放时任何应用程序都可以在其上运行。
第 1 步:拖放。
第 2 步:打开 iOS 模拟器启动 safari 播放视频文件。
第 3 步:点击分享图标以获取“保存视频”选项在操作列表中。
但是多次点击“保存视频”操作却没有任何反应,没有任何内容被添加到相册中。有什么想法吗?甚至尝试将视频文件复制粘贴到模拟器的 DCIM 路径中。
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.
好吧,试试这个:
您可以将 temp.mov 更改为 temp.m4v 以将 vid 保存为 m4v。
如果你改变你的电影文件的网址,这应该工作得很好......
电影保存在此目录中:
/Library/Application Support/iPhone Simulator/4.3.2/Media/DCIM
但你是对的,如果我将文件复制到其中,它不会显示在模拟器的
问候语中
okey, try this:
You can change the temp.mov to temp.m4v to save the vid in m4v.
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
简短回答:
长答案:
文件,它是隐藏的。 使其可见或用户终端。
如果您有多个 iOS 模拟器,请选择您正在开发的一个
目前来说。 (我有 5.0、5.1、6.0 和 6.1)
删除导航到 ~/Library/Application 中的 PhotoData 文件
Support/iPhone Simulator/6.1/Media/ 强制模拟器
识别新文件,因为您没有通过正常方式添加它。
Xcode 4.6.3 和 MacOS 10.8.4 仅供参考。还没有在 Xcode 5 上尝试过。
Short answer:
Long Answer:
the file, it is hidden. Make it visible or user Terminal.
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)
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.
您可以通过在 appdelegate.m 中添加这两行代码来添加您的文件
You can add Your file by adding these 2 lines of code in appdelegate.m
对于 2022 年,如果您尝试直接从“下载”文件夹导入 .mov 文件,模拟器会给出模糊错误(PHPhotosErrorDomain 错误 -1)。要解决此问题,请将视频移动到根 /~ 目录并将其拖到模拟器中。
XCode 版本 - 13.2
模拟器 iOS 版本 - 15.2
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
转到以下路径和过去的视频
/Users/"username"/Library/Developer/CoreSimulator/Devices/11BFF1F0-2A2B-409A-9727-3267D71E10D4/data/Media
go to following path and past video
/Users/"username"/Library/Developer/CoreSimulator/Devices/11BFF1F0-2A2B-409A-9727-3267D71E10D4/data/Media
2024 从你的Mac上进行屏幕录制,然后将其拖放到模拟器中,它将显示在模拟器的照片应用程序下
2024 make a screen recording from your mac, and then drag and drop it into the simulator, it will be shown under the Photo app of the simulator
如果您询问如何将视频添加到您的应用程序中,这是使用 MediaPlayer.h 库显示视频的简单方法。
您应该为 mp 对象设置许多参数:缩放、控件等。
If you're asking how to add video to your app the simple way to show video using
MediaPlayer.h
lib.You should set many parameters for mp object: scaling, controls, etc.
您需要在应用程序包本身中添加视频。稍后您可以将其复制到文档目录中。
You need to add video in your application bundle itself. Later you can copy that to the documents directory.
已经有一段时间了......拖放不知何故对我来说不适用于视频文件(对于 .mov 和 .mp4)。所以我采用了答案之一中的 obj-c 代码
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
打开 safari 浏览器并在模拟器中下载视频
https://www.sample-videos.com/< /a>
Open safari browser and download the video in simulator
https://www.sample-videos.com/
2022 年,只需将视频(例如 Mac 上的屏幕录制)拖放到 iPhone 模拟器中,它就会出现在“照片”中
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