我试图使用UIImagePickerController与UIImagePickerControllerSourceTypePhotoLibrary,但它说,“没有照片”。模拟器从哪里获得图像?我应该在哪里复制图像,以便它们在模拟器中显示?


当前回答

在iOS 8.0中,我们添加了将图像拖放到iOS模拟器中的功能。您可以将一堆图像拖到窗口中,它们应该被导入到该模拟设备的照片卷轴中。您还可以使用simctl命令行工具完成此操作。xrun simctl addphoto

其他回答

没有一个答案是我需要的。

我发现自己在iOS 5.0及以上模拟器上工作的步骤如下:

关闭模拟器,如果它正在运行xcode项目。 运行模拟器从码头点击它。 拖放图像到模拟器。 点击并按住图片(在safari中打开)并选择保存选项。

你完成了。

如果你需要导入不止一、两张照片,那就看看我写的这篇文章。它描述了一种简单的方法来执行批量导入照片,适用于iOS 4.x。

只是告诉你:KONG的解决方案也适用于iOS 7测试版。

他的解决方案是:

将图像拖到模拟器,然后打开Safari(或在互联网上使用Safari浏览图像) 按住图像上的鼠标 当弹出窗口出现时,选择保存图像并享受;)

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.

只需将图像拖到iPhone模拟器。