2010-09-02 49 views
0

我试图得到一个基本的图像拾取/摄接受者在我的应用程序运行,并且遇到了以下错误:的iOS 4:FigCreateCGImageFromJPEG返回-1

*** ERROR: FigCreateCGImageFromJPEG returned -1. Input (null) was 551120 bytes 

我有图像拾取显示,该相机视图正常工作。

当我用相机拍摄图像并选择'使用'按钮时,错误出现在控制台中,应用程序崩溃。

该应用程序工作正常,只是为了从相册中选择一个图像。我在这里看过similar threads,似乎没有提出解决方案。

只是想知道是否有人遇到任何有用的东西。

-(IBAction)getPhoto:(id)sender{ 
    if((UIButton *) sender == sharePhoto) { 
     imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; 
    } else { 
     imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    } 
    [self presentModalViewController:imagePicker animated:YES]; 
} 

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 
    [picker dismissModalViewControllerAnimated:YES]; 
    imageView.image = [info objectForKey:@""]; 
} 

回答

2

我已经设法阻止我的应用程序崩溃,但错误仍然存​​在。

而是指定从NSDictionary *infoUIImage直奔我UIImageView我保留它在一个UIImage变量则取消ModalViewcontroller

viewWillAppear根的方法UIViewController然后我将图像分配给我的UIImageView .image。

我不知道我是否在做事情的顺序是根本原因。错误仍然出现在控制台中。