iPhone 4.0模拟器: didFinishPickingMediaWithInfo is missing UIImagePickerControllerOriginalImage?

标签 iphone ios-simulator uiimagepickercontroller ios4

我有一个简单的UIImagePickerController,它尝试抓取原始选定的图像:

if ([UIImagePickerController isSourceTypeAvailable:
     UIImagePickerControllerSourceTypePhotoLibrary]) {

    if(defaultpicker == nil){
        defaultpicker = [[UIImagePickerController alloc] init];
    }

    defaultpicker.delegate = self;
    defaultpicker.allowsEditing = NO;
    defaultpicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:defaultpicker animated:YES];
}

选择后:

- (void)imagePickerController:(UIImagePickerController *)imagepicker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    [imagepicker dismissModalViewControllerAnimated:YES];

    NSString* key = nil;

    for(key in info){
        NSLog(@"Info: %@", key);
    }

    UIImage *theImage = (UIImage *)[info objectForKey: UIImagePickerControllerOriginalImage];

我使用 4.0 作为基础 SDK,目前的目标是 3.1.3。运行4.0模拟器,信息集合仅包含:

2010-07-07 16:19:33.414 ******[516:307] Info: UIImagePickerControllerMediaType

在设备上,或在 iPad 3.2 模拟器中运行,我得到:

2010-07-07 16:19:33.405 ****[516:307] Info: UIImagePickerControllerOriginalImage

2010-07-07 16:19:33.414 ****[516:307] Info: UIImagePickerControllerMediaType

我错过了什么吗?在我更新到 SDK 4.0 之前,这工作正常。我没有任何警告等。

显然,如果模拟器中没有原始图像,我无法显示所选图像或对所选图像执行任何操作,因为我不知道它是什么。

最佳答案

我正在运行 4.0(3GS)的设备上运行并遇到同样的问题。以前也运行得很好。所以这不是模拟器错误。然而对我来说,这似乎只有在用户创建的相册时才会发生。如果从相机胶卷中选择或用相机拍摄,效果很好:/。

如果我找到解决方案(现在正在研究),我会发布。

更新:这似乎是苹果的一个错误,因为正如我们都指出的那样,返回的信息字典仅包含媒体类型的键值对,即使该值是“public.image”,但它不包含按应有的方式在 UIImagePickerControllerOriginalImage 键中返回该图像。我已提交错误报告,错误 ID# 8176175。

关于iPhone 4.0模拟器: didFinishPickingMediaWithInfo is missing UIImagePickerControllerOriginalImage?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3196349/

相关文章:

iphone - pdf文件文本阅读和搜索

iphone - 没有推送通知的系统范围警报

ios - 在 iOS7 UITabbarController 中,如何停止在点击已选择的 tabBarItem 时将 navigationController 重置为 root?

ios - 如何使用命令行从 iPhone 模拟器卸载应用程序?

ios - 如何使用 ios 从 s3 下载一组文件?

iphone - 强制 UIImagePickerController 以纵向/尺寸 iOS 拍照

ios - iOS 中的 NSURLConnection 和基本 HTTP 身份验证

ios - 带有用户照片的相机叠加层未保存为已编辑

iphone - 呈现 UIImagePickerController 删除当前 Controller 上的导航栏

ios - 在 iOS 模拟器上以 Release模式 Flutter 启动应用程序时出现问题