我试图使用UIImagePickerController与UIImagePickerControllerSourceTypePhotoLibrary,但它说,“没有照片”。模拟器从哪里获得图像?我应该在哪里复制图像,以便它们在模拟器中显示?
当前回答
1. CD到此路径:
/用户/ (macOS用户)/图书馆/开发/ CoreSimulator /设备/[模拟器 标识符]/数据/媒体/ DCIM / 100苹果 [模拟器标识符]或UDID可以在以下位置找到:Hardware => device => manage devices。 如。cd /用户/ rnDeveloper /图书馆/开发/ CoreSimulator /设备/ 7508171 a-dc5d-47cf-9be1-ff950326e3db /数据/媒体/ DCIM / 100苹果
2. 下载图片:
Curl -o pic_001.jpg “https://s-media-cache-ak0.pinimg.com/474x/49/25/7a/49257a4b3287b7841922ecdff855fd80.jpg”
3.重新启动模拟器以查看新文件。
其他回答
在iOS 8.0中,我们添加了将图像拖放到iOS模拟器中的功能。您可以将一堆图像拖到窗口中,它们应该被导入到该模拟设备的照片卷轴中。您还可以使用simctl命令行工具完成此操作。xrun simctl addphoto
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.
对于iOS 5.1,这将进一步更改为new path
~/库/应用程序支持/iPhone模拟器/5.1/媒体/DCIM/100APPLE
对于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
3个简单步骤
拖放图像到模拟器 -这将打开一个浏览器与您的图像 点击并按住图片 -这将打开选项 保存图像 -这将复制图像到模拟器
观看YouTube视频(将图像添加到iphone模拟器)
推荐文章
- 我如何改变UIButton标题颜色?
- 在Swift中如何调用GCD主线程上的参数方法?
- NSLayoutConstraints是可动画的吗?
- iOS -构建失败,CocoaPods无法找到头文件
- Xcode 4挂在“附加到(应用程序名称)”
- CFNetwork SSLHandshake iOS 9失败
- 请求失败:不可接受的内容类型:文本/html使用AFNetworking 2.0
- 缺少推荐的图标文件-该包不包含iPhone / iPod Touch的应用程序图标,像素为“120x120”,png格式
- 以编程方式创建segue
- 如何使用Xcode创建。ipa文件?
- 我可以在没有“构建和运行”的情况下启动iPhone模拟器吗?
- 动态改变UILabel的字体大小
- Xcode 4 -在新的Macintosh安装上的配置文件上“没有找到有效的签名标识”错误
- 在iPhone上确定用户是否启用了推送通知
- 是否有可能禁用浮动头在UITableView与UITableViewStylePlain?