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


当前回答

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.

其他回答

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.

一个更简单的方法是: 在模拟器>上打开safari,点击www.google.com 搜索随机照片“自然” 打开每个图像,按下并保存。

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

以上这些答案在iOS 15上都不适用。

我简单地打开文件应用程序,拖放图像在那里。它会自动将图片导入到照片应用程序中,我可以通过模拟器在任何地方使用。

干杯!

只需拖放图像到iphone模拟器。浏览器将打开显示您的图像。 按下图像,直到你没有收到保存图像的选项。然后保存图像。 就是这样:)。你会看到你的图像在你的模拟器....的照片应用程序