UIImagePicker无法显示操作系统3.1.2中的照片库的原始图像
问题描述:
Holy Crap!真的......我对这个问题感到沮丧,这让我在一周内陷入了我的应用程序。UIImagePicker无法显示操作系统3.1.2中的照片库的原始图像
下面是代码
- (IBAction)loadTheImage {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
// picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
如果我设置源为SavedPhotosAlbum(相机胶卷),那么它的工作原理确定。但是当我将它设置为PhotoLibrary时,它只返回nil。而这只发生在OS3.1.2中。在OS4中,它工作正常(即返回原始图像就好)。
有人吗?
答
给定的源可能并不总是在每个设备上都可用。这可能是因为源不在物理上或因为它目前无法访问。
在尝试使用UIImagePickerController对象选取图像之前,必须先调用[UIImagePickerController isSourceTypeAvailable:]
方法确保所需的源类型可用。
究竟是什么零?它只是原始图像的价值,还是整个用户信息字典?选取器值是否为零? – TechZen 2010-07-21 12:47:16