2010-09-02 51 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。

我不知道我是否在做事情的順序是根本原因。錯誤仍然出現在控制檯中。