无法加载4S拍摄的图像,但可以加载5S

时间:2014-05-02 05:09:43

标签: ios iphone objective-c ios7 uiimagepickercontroller

我的应用程序从UIImagePickerController接收图像,当图像来自5S时我可以在调试中快速查看图像,但是如果图像来自4S我无法查看它而我的应用程序确实没有正常工作。

以下是UIImagePickerController

的代码
- (IBAction)scanButton:(UIButton *)sender
{

    _imagePicker = [[UIImagePickerController alloc] init];

    _imagePicker.delegate = self;
    _imagePicker.sourceType = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] ? UIImagePickerControllerSourceTypeCamera :  UIImagePickerControllerSourceTypePhotoLibrary;

    if (_imagePicker.sourceType == UIImagePickerControllerSourceTypeCamera) {

         //_imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
        _imagePicker.showsCameraControls = NO;
        CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 71.0); //This slots the preview exactly in the middle of the screen by moving it down 71 points
        _imagePicker.cameraViewTransform = translate;

        CGAffineTransform scale = CGAffineTransformScale(translate, 1.333333, 1.333333);
        _imagePicker.cameraViewTransform = scale;

        CGRect screenRect = [[UIScreen mainScreen]bounds];
        _overlay = [[CameraOverlay alloc] initWithFrame:CGRectMake(0, 0, screenRect.size.width, screenRect.size.height)];
        [_overlay.shootButton addTarget:self action:@selector(takePhoto) forControlEvents:UIControlEventTouchUpInside];
        [_overlay.cancelButton addTarget:self action:@selector(cancelPhoto) forControlEvents:UIControlEventTouchUpInside];
        [_overlay.flashButton addTarget:self action:@selector(flashButton) forControlEvents:UIControlEventTouchUpInside];
        _imagePicker.cameraOverlayView = _overlay;

    }

    _imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
    _imagePicker.allowsEditing = NO;

    [self presentViewController:_imagePicker animated:YES completion:NULL];

}

我的didFinish方法

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

    _image = info[UIImagePickerControllerOriginalImage];

    _pickerDismissed = YES;
    [self dismissViewControllerAnimated:YES completion:nil];


}

当我从5S查看_image时我可以加载图像,但是从4S我不能。

有谁知道为什么会这样?

1 个答案:

答案 0 :(得分:0)

听起来很奇怪,试试不同的iPhone 4S

相关问题