UIPopoverController中的iPad UIImagePicker是否仅选择保存的图像(而不是相册)?
在我的iPad应用程序中,我允许用户使用以下代码选择图像:UIPopoverController中的iPad UIImagePicker是否仅选择保存的图像(而不是相册)?,ipad,uiimagepickercontroller,uipopovercontroller,Ipad,Uiimagepickercontroller,Uipopovercontroller,在我的iPad应用程序中,我允许用户使用以下代码选择图像: UIImagePickerController* picker = [[UIImagePickerController alloc] init]; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker.delegate = self; UIPopoverController *popover = [[UIPopoverControlle
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.popoverController = popover;
popoverController.delegate = self;
[popoverController presentPopoverFromRect:self.view.frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
[picker release];
(我已将该类设置为UIPopoverControllerDelegate和UIImagePickerController Delegate,并已为这两个代理设置回调。)
现在,奇怪的是,如果我从“保存的照片”相册中选择一张图像,我的“imagePickerController:didFinishPickingImage”回调方法就会被调用,我会得到一张图像,一切正常
但是,如果我从任何其他相册中选择了一个图像,我的“ImagePickerController IDCancel”回调就会被调用,而我不会得到图像
有什么想法吗?我在网上到处搜索
谢谢,
鲁文
情节越来越复杂 添加时:
allowsEditing=是 我仍然可以从保存的相册中选择(和裁剪/缩放)图像,但当尝试使用其他相册中的图像时,iPad会崩溃,调试器显示: 2010-06-03 08:16:06.759 uPrintMobile[98412:207]*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“*-[NSCFDictionary setObject:forKey:::]:尝试插入零值(键:UIImagePickerControllerOriginalImage)”
仍然没有线索…尝试使用
UIImagePickerControllerSourceTypePhotoLibrary的其他选项
在委托方法中,检查如下条件
`if( image is from photo library ) {
// do something
} else if ( image from saved albums ) {
// do something
}`
我知道这已经是几个月后的事了,但我也遇到了同样的问题,我发现尽管这里有人问了很多次,但都没有人回答。好吧,我很高兴地说,我找到了答案,所以我把它贴在了搜索中最先出现的几个几乎相同的问题上
我在这里发布了完整答案:
您有没有针对这一部分的解决方案。我在这里也遇到了麻烦。如果您有解决方案,请提供帮助Christina,您使用的是什么版本的xcode/ios?您好,我的情况也一样。使用iPad模拟器5.0、5.1、6.0进行测试,所有的OriginalImage和/或EditeImage都为零。只有iPad SIM 4.3工作正常。在这个设备上,我的iPad运行的是5.1.1版本,它可以正常工作。所以我猜测iPad sim卡中有一个bug,并忽略了它。