【发布时间】:2010-05-27 09:52:54
【问题描述】:
在我的 iPad 应用程序中,我让用户使用以下代码选择图像:
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 和 UIImagePickerControllerDelegate,并为两个委托设置了回调。)
现在,奇怪的是,如果我从“已保存的照片”相册中选择一张图片,我的“imagePickerController:didFinishPickingImage”回调方法就会被调用,我得到一张图片,一切都很好。
但是,如果我从任何其他相册中选择一张图片,我的“imagePickerControllerDidCancel”回调会被调用 - 我不会取回图片。
有什么想法吗?我已经在网上搜索了高低......
谢谢, 鲁文
情节变厚了……
添加时:
允许编辑 = YES;
我仍然可以从“已保存的照片”相册中选择(和裁剪/缩放)图像 - 但在尝试使用其他相册中的图像时,iPad 崩溃并显示调试器:
2010-06-03 08:16:06.759 uPrintMobile[98412:207] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“* -[NSCFDictionary setObject:forKey:]:尝试插入 nil 值(键:UIImagePickerControllerOriginalImage)'
还是没有头绪……
【问题讨论】:
-
你有这部分的任何解决方案。我在这里也很震惊。如果你有解决方案,请帮忙
-
Christina,你用的是什么版本的 xcode/ios?
-
您好,我的情况也是如此。使用 iPad SIMULATOR 5.0、5.1、6.0 测试时,OrigninalImage 和/或 EditedImage 均为零。只有 iPad SIM 4.3 可以正常工作。在设备上,我的 iPad 运行的是 5.1.1 并且可以正常工作。所以我猜测 iPad sim 中的一个错误并忽略它。
标签: ipad uiimagepickercontroller uipopovercontroller