我试图使用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.

其他回答

试试我做的这个应用。下载代码并在模拟器https://github.com/cristianbica/CBSimulatorSeed中运行

对于iOS 7,我做了以下操作:

复制照片到这两个文件夹:

~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE
~/Library/Application Support/iPhone Simulator/7.0/Media/DCIM/100APPLE

只删除这4个文件(以避免重新启动时重复):

~/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

最简单的解决方案是在模拟器上登录iCloud,然后使用iCloud传输驱动器中的任何文件,包括照片。

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

3个简单步骤

拖放图像到模拟器 -这将打开一个浏览器与您的图像 点击并按住图片 -这将打开选项 保存图像 -这将复制图像到模拟器

观看YouTube视频(将图像添加到iphone模拟器)