iOS 4:FigCreateCGImageFromJPEG 返回 -1

发布于 2024-09-18 04:35:23 字数 979 浏览 2 评论 0原文

我试图在我的应用程序中运行一个基本的图像选择器/照片拍摄器,但遇到了以下错误:

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

我显示了图像选择器,相机视图工作正常。

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

该应用程序仅适用于从相册中选择图像。我在这里查看了类似的线程,似乎没有解决方案已被提议。

只是想知道是否有人遇到过任何有帮助的事情。

-(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:@""];
}

I'm trying to get a basic image picker/photo taker running in my app and have run into the following error:

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

I have the image picker showing, the camera view works fine.

When I take an image with the camera and select the 'use' button the error appears in the console and the app crashes.

The App works fine just for selecting an image from the album. I have looked at similar threads here and no solution seems to have been proposed.

Just wondering if anyone has come across anything helpful.

-(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:@""];
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多像笑话 2024-09-25 04:35:23

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

我没有将 NSDictionary *info 中的 UIImage 直接分配给我的 UIImageView,而是将其保留在 UIImage 变量中,然后关闭ModalViewcontroller

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

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

I have managed to stop my application crashing but the error persist.

Instead of assigning the UIImage from the NSDictionary *info straight to my UIImageView I retain it in a UIImage variable then dismiss the ModalViewcontroller.

In the viewWillAppear method of the root UIViewController I then assign the image to my UIImageView.image.

I don't know if the order I was doing things was the root cause. The error still appears in the console however.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文