我在Mac上有照片,我想添加到iPhone模拟器来测试我的应用程序.
换句话说:如何将照片添加到iPhone模拟器?
编辑:iPhone模拟器4.0怎么样?iphone Simulator 3.0和4.0都有不同的工作方式.
在此先感谢帮助我......
我有xcode 4.5.1,想要将照片添加到iphone 6.0模拟器,但无法找到它.我有一个名为iphone模拟器的文件夹,但它只包含4.3.1.可能是因为几个月前我将应用程序支持中的几乎所有内容拖到我的外部硬盘上以节省一些内存.现在,当我将其拖回时,它包含我之前使用过的4.3.1.我是否必须下载新内容或我应该怎么做?提前致谢!
我已经习惯UIImagePickerController了UIImagePickerControllerSourceTypePhotoLibrary,但它说"没有照片".
模拟器从哪里获取图像?我应该在哪里复制图像,以便它们显示在模拟器中?
我已经尝试过我读过的每一个技巧,包括Stack Overflow上的答案都无济于事.
对于#1,这就是我所拥有的
~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/IMG_0000.JPG
~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/.MISC/IMG_0000.THM
Run Code Online (Sandbox Code Playgroud)
它们都是实际的jpeg文件.实际上,它们都是完全相同文件的副本.
有任何想法吗?
我一直在物理iOS设备上运行我的应用程序一段时间没有任何问题.但是现在UIImagePickerController视图不会出现在模拟器上.我已经使用此处的方法将照片保存到模拟器中,并确认它们确实存在于图像库中的模拟器上.Xcode中没有弹出错误.我尝试过使用不同的源类型,但无济于事.知道我可能做错了什么吗?非常感谢!
码
UIImagePickerControllerSourceType sourceType;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
else
{
sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
//Display photo library.
[self startImagePickerControllerFromViewController: self
usingDelegate: self
withSourceType: sourceType];
...
- (BOOL)startImagePickerControllerFromViewController:(UIViewController*) controller
usingDelegate:(id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate
withSourceType:(UIImagePickerControllerSourceType) sourceType
{
//Insure camera, controller, and delegate exist.
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO)
|| (delegate == nil)
|| (controller == nil))
return NO;
//Create the ImagePicker.
UIImagePickerController *imagePickerUI = [[UIImagePickerController alloc] init];
imagePickerUI.sourceType = sourceType;
//Only allow still images.
imagePickerUI.mediaTypes = …Run Code Online (Sandbox Code Playgroud) 我正在尝试将图像拖放到我的 iPhone 模拟器中。我发现可以在 SO Adding images or video to iPhone Simulator上这样做。但是,当我尝试拖放简单的 png 或 jpeg 图像时,出现错误
\n\noperation couldn\xe2\x80\x99t be completed. (PHPhotosErrorDomain error -1.)\nRun Code Online (Sandbox Code Playgroud)\n\n我知道答案中的解决方案已经有 9 年历史了,而且我还没有找到任何最新的解决方案,那么有什么变化吗?
\n\n我的iOS模拟器版本是
\n\n版本 11.5 (921.9.1)\nSimulatorKit 581.9.1\nCoreSimulator 704.12.2
\n